#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cout << fixed;
  cout << setprecision(10);
  ;
  long long int T = 1;
  while (T--) {
    long long int n, t;
    cin >> n >> t;
    long long int mn = 1000000000000000001;
    ;
    long long int a[n], d, mx = 0, c = 0;
    for (long long int i = 0; i < n; i++) {
      cin >> d;
      mn = min(mn, d);
      a[i] = d - mn;
      mx = max(mx, a[i]);
    }
    for (long long int i = 0; i < n; i++) c += (a[i] == mx);
    if (mx == 0)
      cout << 0 << "\n";
    else
      cout << min(t / 2, c) << "\n";
  }
  return 0;
}
