from collections import defaultdict



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

A = [int(x) for x in input().split()]



B = [0] * N

for i in range(N - 1):

    a = A[N - i - 1]

    B[i + 1] = max(B[i], a)

B = B[::-1]



c = defaultdict(int)

for i in range(N - 1):

    c[B[i] - A[i]] += 1

print((c[max(c)]))

from itertools import accumulate

from collections import defaultdict



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

A = [int(x) for x in input().split()]



B = [x for x in accumulate(A[::-1], max)][::-1]

c = defaultdict(int)

for i in range(N - 1):

    c[B[i] - A[i]] += 1

print((c[max(c)]))
from collections import defaultdict

N, T = list(map(int, input().split()))
A = [int(x) for x in input().split()]
B = [0] * N
for i in range(N - 1):
    a = A[N - i - 1]
    B[i + 1] = max(B[i], a)
B = B[::-1]
c = defaultdict(int)
for i in range(N - 1):
    c[B[i] - A[i]] += 1
print((c[max(c)]))

from itertools import accumulate
from collections import defaultdict

N, T = list(map(int, input().split()))
A = [int(x) for x in input().split()]
B = [x for x in accumulate(A[::-1], max)][::-1]
c = defaultdict(int)
for i in range(N - 1):
    c[B[i] - A[i]] += 1
print((c[max(c)]))

+from itertools import accumulate -B = [0] * N -for i in range(N - 1): -    a = A[N - i - 1] -    B[i + 1] = max(B[i], a) -B = B[::-1] +B = [x for x in accumulate(A[::-1], max)][::-1]