#! /usr/bin/env python3



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

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

pu = -1

SPU = set([])

SPD = []

b = 0

c = 0

for i in A[:-1][::-1]:

    if i > A[pu]:

        pu = -c-2

    elif i < A[pu] and A[pu]-i >= b:

        SPU.add(pu)

        b = A[pu]-i

        SPD += [b]

    c += 1



print((min(len(SPU), SPD.count(b))))
#! /usr/bin/env python3



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

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

p = -1

dif = h = hc = lc = c = 0

for i in A[-2::-1]:

    a, b = A[p], A[p]-i

    if i > a:

        p = -c-2

    elif b >= dif:

        if a != h : h, hc = a, hc+1

        if b > dif : dif, lc = b, 0

        lc += 1

    c += 1

print((min(hc, lc)))
#! /usr/bin/env python3
N, T = list(map(int, input().split()))
A = list(map(int, input().split()))
pu = -1
SPU = set([])
SPD = []
b = 0
c = 0
for i in A[:-1][::-1]:
    if i > A[pu]:
        pu = -c - 2
    elif i < A[pu] and A[pu] - i >= b:
        SPU.add(pu)
        b = A[pu] - i
        SPD += [b]
    c += 1
print((min(len(SPU), SPD.count(b))))

#! /usr/bin/env python3
N, T = list(map(int, input().split()))
A = list(map(int, input().split()))
p = -1
dif = h = hc = lc = c = 0
for i in A[-2::-1]:
    a, b = A[p], A[p] - i
    if i > a:
        p = -c - 2
    elif b >= dif:
        if a != h:
            h, hc = a, hc + 1
        if b > dif:
            dif, lc = b, 0
        lc += 1
    c += 1
print((min(hc, lc)))

-pu = -1 -SPU = set([]) -SPD = [] -b = 0 -c = 0 -for i in A[:-1][::-1]: -    if i > A[pu]: -        pu = -c - 2 -    elif i < A[pu] and A[pu] - i >= b: -        SPU.add(pu) -        b = A[pu] - i -        SPD += [b] +p = -1 +dif = h = hc = lc = c = 0 +for i in A[-2::-1]: +    a, b = A[p], A[p] - i +    if i > a: +        p = -c - 2 +    elif b >= dif: +        if a != h: +            h, hc = a, hc + 1 +        if b > dif: +            dif, lc = b, 0 +        lc += 1 -print((min(len(SPU), SPD.count(b)))) +print((min(hc, lc)))