#include<bits/stdc++.h>
#define X first
#define Y second
using namespace std;
typedef pair<int,int> pii;
const int N = 100005, inf = 2e9;

int n, t, mn = inf, mx, ans;

int main()
{
	scanf("%d%d",&n,&t);
	for(int i=1;i<=n;i++) {
		scanf("%d",&t);
		mn = min(mn, t);
		if(mx < t - mn) {mx = t - mn; ans = 0;}
		if(mx == t - mn) ans++;
	}
	printf("%d\n",ans);
}
