using System;
using System.Collections.Generic;
using System.Text;
using System.Linq;

class Program
{
    public void Proc()
    {
        Reader.IsDebug =　false;
        long[] inpt = Reader.ReadLine().Split(' ').Select(a => long.Parse(a)).ToArray();
        this.MaxCount = inpt[1];

        Reader.ReadLine().Split(' ').Select(a => long.Parse(a)).ToList().ForEach(a => Pricce.Add(Pricce.Count, a));
        long[] saidai = new long[Pricce.Count];
        long max = 0;
        for (int i = Pricce.Count - 1; i >= 0; i--)
        {
            max = Math.Max(max, Pricce[i]);
            saidai[i] = max;
        }

        long[] from = new long[Pricce.Count];
        long[] to = new long[Pricce.Count];



        long maxRieki = long.MinValue;
        for (int i = 0; i < Pricce.Count - 1; i++)
        {
            if (saidai[i + 1] <= Pricce[i])
            {
                continue;
            }
            long mx = saidai[i + 1];
            long tmp = mx - Pricce[i];
            if (tmp > maxRieki)
            {
                maxRieki = tmp;
            }
            if (tmp >= maxRieki)
            {
                from[i] = maxRieki;
                Pricce.Skip(i + 1).Where(a => a.Value == mx).ToList().ForEach(a => to[a.Key] = maxRieki);
            }
        }

        int ans = Math.Min(from.Count(a => a == maxRieki), to.Count(a => a == maxRieki));
        Console.WriteLine(ans);
    
    }



    private long MaxCount;


    private Dictionary<int, long> Pricce = new Dictionary<int, long>();


    


    public class Reader
    {
        public static bool IsDebug = true;
        private static String PlainInput = @"

10 100
7 10 4 5 9 3 6 8 2 1



";
        private static System.IO.StringReader Sr = null;
        public static string ReadLine()
        {
            if (IsDebug)
            {
                if (Sr == null)
                {
                    Sr = new System.IO.StringReader(PlainInput.Trim());
                }
                return Sr.ReadLine();
            }
            else
            {
                return Console.ReadLine();
            }
        }
    }
    static void Main()
    {
        Program prg = new Program();
        prg.Proc();
    }
}