#include <bits/stdc++.h>
using namespace std;
int n, t;
int a[100000];
int p;
int m;
int ans;
int main() {
  scanf("%d %d", &n, &t);
  for (int i = 0; i < n; i++) scanf("%d", &a[i]);
  int s = t / 2;
  for (int i = 0; i < n - 1; i++) {
    for (int j = 1; i + j <= n - 1; j++) {
      p = s * (a[i + j] - a[i]);
      if (m == p) {
        ans++;
      } else if (m < p) {
        m = p;
        ans = 1;
      }
    }
  }
  printf("%d\n", ans);
  return 0;
}
