#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  int n, k;
  cin >> n >> k;
  vector<int> a(n + 1), mi(n + 1);
  mi[0] = 1e9 + 5;
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
    mi[i] = min(mi[i - 1], a[i]);
  }
  int mx = 0, cnt = 0;
  for (int i = 1; i <= n; i++) mx = max(mx, a[i] - mi[i - 1]);
  for (int i = 1; i <= n; i++)
    if (mx == a[i] - mi[i]) cnt++;
  cout << min(cnt, k / 2) << '\n';
}
