n, t = list(map(int, input().split()))

a = list(map(int, input().split()))



vm = a[n - 1]#数列を右から見た時の最大値

dfm = 0

cnt = 0

for i in range(n - 2, -1, -1):

    if a[i] > vm:

        vm = a[i]

    else:

        df = vm - a[i]

        if dfm < df:

            dfm = df

            cnt = 1

        elif dfm == df:

            cnt += 1



print(cnt)
def main():

    from heapq import heappush



    inf = 1 << 30



    N, T = list(map(int, input().split()))

    *A, = list(map(int, input().split()))



    h = [inf]

    ma = -1

    cnt = 0

    for x in A:

        d = x - h[0]

        if ma < d:

            ma = d

            cnt = 1

        elif ma == d:

            cnt += 1

        heappush(h, x)



    print(cnt)





if __name__ == '__main__':

    main()

n, t = list(map(int, input().split()))
a = list(map(int, input().split()))
vm = a[n - 1]  # 数列を右から見た時の最大値
dfm = 0
cnt = 0
for i in range(n - 2, -1, -1):
    if a[i] > vm:
        vm = a[i]
    else:
        df = vm - a[i]
        if dfm < df:
            dfm = df
            cnt = 1
        elif dfm == df:
            cnt += 1
print(cnt)

def main():
    from heapq import heappush

    inf = 1 << 30
    N, T = list(map(int, input().split()))
    (*A,) = list(map(int, input().split()))
    h = [inf]
    ma = -1
    cnt = 0
    for x in A:
        d = x - h[0]
        if ma < d:
            ma = d
            cnt = 1
        elif ma == d:
            cnt += 1
        heappush(h, x)
    print(cnt)


if __name__ == "__main__":
    main()

-n, t = list(map(int, input().split())) -a = list(map(int, input().split())) -vm = a[n - 1]  # 数列を右から見た時の最大値 -dfm = 0 -cnt = 0 -for i in range(n - 2, -1, -1): -    if a[i] > vm: -        vm = a[i] -    else: -        df = vm - a[i] -        if dfm < df: -            dfm = df +def main(): +    from heapq import heappush + +    inf = 1 << 30 +    N, T = list(map(int, input().split())) +    (*A,) = list(map(int, input().split())) +    h = [inf] +    ma = -1 +    cnt = 0 +    for x in A: +        d = x - h[0] +        if ma < d: +            ma = d -        elif dfm == df: +        elif ma == d: -print(cnt) +        heappush(h, x) +    print(cnt) + + +if __name__ == "__main__": +    main()