#include <stdio.h>
#include <vector>
#include <limits>
#include <map>
#include <iostream>

using namespace std;
int main() {
  int n, t;
  scanf("%d %d", &n, &t);
  vector<int> a(n);
  for (int i = 0; i < n; ++i) scanf("%d", &a[i]);

  int mi = a[0];
  int ma = -(int)1e9;
  map<int, int> m;
  for (int i = 1; i < n; ++i) {
    int diff = a[i] - mi;
    m[diff]++;
    mi = min(mi, a[i]);
    ma = max(ma, diff);
  }
  printf("%d\n", m[ma]);
  return 0;
}

