#include <bits/stdc++.h>

#define MAXN (100010)

int n, t;
int a[MAXN];

int main(){
	scanf("%d%d", &n, &t);
	for(int i = 1; i <= n; ++ i){
		scanf("%d", a + i);
	}
	int maxDelta = 0, nowmax = a[n], ans = 0;
	for(int i = n - 1; i; -- i){
		if(nowmax - a[i] > maxDelta){
			maxDelta = nowmax - a[i];
			ans = 1;
		}
		else if(nowmax - a[i] == maxDelta){
			++ ans;
		}
		nowmax = std::max(nowmax, a[i]);
	}
	printf("%d\n", ans);
	return 0;
}