using System;
class Program
{
    static void Main()
    {
        string[] input = Console.ReadLine().Split(' ');
        int N = int.Parse(input[0]);
        int T = int.Parse(input[1]);
        int[] A = new int[100000];
        input = Console.ReadLine().Split(' ');
        for (int i = 0; i < N; i++) A[i] = int.Parse(input[i]);
        int minnum = A[0];
        int mingap = 0;
        int mintime = 0;
        for (int i = 1; i < N; i++)
        {
            if (A[i] < minnum) minnum = A[i];
            else if (A[i] - minnum > mingap)
            {
                mintime = 1;
                mingap = A[i] - minnum;
            }
            else if (A[i] - minnum == mingap) mintime++;
        }
        Console.WriteLine(mintime);
    }
}