#include <iostream>
#include <string>
#include <cmath>
using namespace std;



int main() {
	int n,t;
	int a;
	int minValue = 1e9 + 1;
	int point = 0;
	int pointCount = 0;

	cin >> n >> t;

	for (int i = 0; i < n; i++) {
		cin >> a;
		if (a < minValue) {
			minValue = a;
			continue;
		}

		int tmpPoint = a - minValue;
		if (point > tmpPoint) {
			continue;
		} 
		if (point == tmpPoint) {
			pointCount++;
			continue;
		}
		pointCount = 1;
		point = tmpPoint;
	}

	cout << pointCount << endl;

	return 0;
}