#include <bits/stdc++.h>
using namespace std;
int a[100000], m[100000];
int main() {
  int n, t, div = 0, sum = 0;
  bool f = false;
  cin >> n >> t;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  m[n - 1] = a[n - 1];
  for (int i = n - 2; i > 0; i--) {
    m[i] = max(m[i + 1], a[i]);
    div = max(div, m[i] - a[i]);
  }
  for (int i = n - 2; i > 0; i--) {
    if (div == m[i] - a[i]) {
      sum++;
    }
  }
  cout << sum;
  return 0;
}
