import std.stdio;
import std.string;
import std.conv;
import std.algorithm;
import std.array;
void main()
{
	auto NT = readln.chomp.split(' ').map!(to!long).array;
    long N = NT[0];
    long T = NT[1];
    long[] B;
    auto A = readln.chomp.split(' ').map!(to!long).array;
    long minA = A[0];
    foreach(i;1 .. N)
    {
        B ~= A[i] - minA;
        minA = min(minA,A[i]);
    }
    B.count(B.reduce!((a,b) => max(a,b))).writeln();
}