#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  int t;
  cin >> n >> t;
  int *a = (int *)malloc(n * sizeof(int));
  int *mina = (int *)malloc(n * sizeof(int));
  int minv = INT_MAX;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    if (minv > a[i]) minv = a[i];
    mina[i] = minv;
  }
  int this_dif = 0;
  int max_dif = 0;
  int dif_num = 0;
  for (int i = 1; i < n; i++) {
    this_dif = a[i] - mina[i];
    if (this_dif > max_dif) {
      max_dif = this_dif;
      dif_num = 1;
    } else if (this_dif == max_dif) {
      dif_num++;
    }
  }
  cout << min(dif_num, t / 2) << endl;
  return 0;
}
