#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int N, T;
  long long int A[100000], B[100000], C[100000];
  long long int min, max, cnt, j;
  std::cin >> N >> T;
  for (int i = 0; i < N; i++) {
    std::cin >> A[i];
  }
  for (int i = 0; i < N; i++) {
    for (j = i; j < N; j++) {
      if (max < A[i] - A[j]) max = A[j] - A[i];
    }
    B[i] = max;
    C[i] = j;
  }
  sort(B, B + 10000);
  for (int i = N - 2; i >= 0; i--) {
    if (B[N - 1] == B[i] && C[N - 1] != C[i]) cnt++;
  }
  std::cout << cnt << std::endl;
  return 0;
}
