#include <bits/stdc++.h>
using namespace std;
int N, A[100005], T, mdp[100005] = {1000000000}, diff[100005] = {0};
int main() {
  cin >> N >> T;
  for (int i = 0; i < N; i++) {
    cin >> A[i];
    if (i > 0)
      mdp[i] = min(mdp[i - 1], A[i]);
    else
      mdp[i] = A[i];
    diff[i] = max(A[i] - mdp[i], 0);
  }
  sort(diff, diff + N);
  int cnt = 0;
  for (int i = 0; i < N; i++) {
    if (diff[i] == diff[N - 1]) cnt++;
  }
  cout << cnt << endl;
  cerr << cnt << endl;
  return 0;
}
