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()

def main():

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

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



    mi = A[0]

    d_ma = -1

    cnt = 0

    for x in A:

        d = x - mi

        if d_ma < d:

            d_ma = d

            cnt = 1

        elif d_ma == d:

            cnt += 1

        if mi > x:

            mi = x



    print(cnt)





if __name__ == '__main__':

    main()

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()

def main():
    N, T = list(map(int, input().split()))
    (*A,) = list(map(int, input().split()))
    mi = A[0]
    d_ma = -1
    cnt = 0
    for x in A:
        d = x - mi
        if d_ma < d:
            d_ma = d
            cnt = 1
        elif d_ma == d:
            cnt += 1
        if mi > x:
            mi = x
    print(cnt)


if __name__ == "__main__":
    main()

-    from heapq import heappush - -    inf = 1 << 30 -    h = [inf] -    ma = -1 +    mi = A[0] +    d_ma = -1 -        d = x - h[0] -        if ma < d: -            ma = d +        d = x - mi +        if d_ma < d: +            d_ma = d -        elif ma == d: +        elif d_ma == d: -        heappush(h, x) +        if mi > x: +            mi = x