#include <bits/stdc++.h>
int main() {
  int N, T;
  int A[10000];
  scanf("%d %d", &N, &T);
  int i;
  for (i = 0; i < N; i++) {
    scanf("%d", &A[i]);
  }
  int min = A[0];
  int maxv = 0;
  int count = 1;
  for (i = 0; i < N; i++) {
    if (min > A[i]) min = A[i];
    if (maxv == (A[i] - min))
      count++;
    else if (maxv < A[i] - min) {
      maxv = A[i] - min;
      count = 1;
    }
  }
  printf("%d", count);
  return 0;
}
