import std.stdio;
import std.conv, std.array, std.algorithm, std.string;
import std.math, std.random, std.range, std.datetime;
import std.bigint;

void main(){
	int n, t;
	{
		int[] tmp = readln.chomp.split.map!(to!int).array;
		n = tmp[0], t = tmp[1];
		}
	int[] as = readln.chomp.split.map!(to!int).array;
	
	int[] bs;
	bs.length = as.length;
	int b = bs[$ - 1];
	for(int i = as.length.to!int - 1; i >= 0; i --){
		if(b < as[i]) b = as[i];
		bs[i] = b;
		}
	
	int[] cs;
	cs.length = as.length;
	for(int i = 0; i < cs.length; i ++) cs[i] = bs[i] - as[i];
	
	int ans;
	int max = -1;
	foreach(c; cs){
		if(c > max) max = c, ans = 1;
		else if(c == max) ans += 1;
		}
	
	ans.writeln;
	
	}