from collections import Counter



N, T, *A = list(map(int, open(0).read().split()))



mi = A[0]

ma = 0



B = Counter()

for a in A[1:]:

    b = a - mi

    B[b] += 1

    ma = max(ma, b)

    mi = min(mi, a)



print((B[ma]))

N, T, A0, *A = list(map(int, open(0).read().split()))



ma, mi = 0, A0

B = {}

for a in A:

    b = a - mi

    B[b] = B.get(b, 0) + 1

    ma, mi = max(ma, b), min(mi, a)



print((B[ma]))
from collections import Counter

N, T, *A = list(map(int, open(0).read().split()))
mi = A[0]
ma = 0
B = Counter()
for a in A[1:]:
    b = a - mi
    B[b] += 1
    ma = max(ma, b)
    mi = min(mi, a)
print((B[ma]))

N, T, A0, *A = list(map(int, open(0).read().split()))
ma, mi = 0, A0
B = {}
for a in A:
    b = a - mi
    B[b] = B.get(b, 0) + 1
    ma, mi = max(ma, b), min(mi, a)
print((B[ma]))

-from collections import Counter - -N, T, *A = list(map(int, open(0).read().split())) -mi = A[0] -ma = 0 -B = Counter() -for a in A[1:]: +N, T, A0, *A = list(map(int, open(0).read().split())) +ma, mi = 0, A0 +B = {} +for a in A: -    B[b] += 1 -    ma = max(ma, b) -    mi = min(mi, a) +    B[b] = B.get(b, 0) + 1 +    ma, mi = max(ma, b), min(mi, a)