def slove():

    import sys

    import collections

    input = sys.stdin.readline

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

    a = list(map(int, input().rstrip('\n').split()))

    b = collections.defaultdict(list)

    m_c = 10 ** 9

    for i, v in enumerate(a):

        if i != 0 and m_c < v:

            b[v-m_c] += [m_c]

        m_c = min(m_c, v)

    b = sorted(list(b.items()), reverse=True)[0]

    print((len(collections.Counter(b[1]))))





if __name__ == '__main__':

    slove()

def slove():

    import sys

    import collections

    input = sys.stdin.readline

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

    a = list(map(int, input().rstrip('\n').split()))

    d = collections.defaultdict(list)

    min_b = 10 ** 9

    max_p = 0

    for v in a:

        p = v - min_b

        max_p = max(max_p, p)

        d[p] += [min_b]

        min_b = min(min_b, v)

    print((len(d[max_p])))





if __name__ == '__main__':

    slove()

def slove():
    import sys
    import collections

    input = sys.stdin.readline
    n, t = list(map(int, input().rstrip("\n").split()))
    a = list(map(int, input().rstrip("\n").split()))
    b = collections.defaultdict(list)
    m_c = 10**9
    for i, v in enumerate(a):
        if i != 0 and m_c < v:
            b[v - m_c] += [m_c]
        m_c = min(m_c, v)
    b = sorted(list(b.items()), reverse=True)[0]
    print((len(collections.Counter(b[1]))))


if __name__ == "__main__":
    slove()

def slove():
    import sys
    import collections

    input = sys.stdin.readline
    n, t = list(map(int, input().rstrip("\n").split()))
    a = list(map(int, input().rstrip("\n").split()))
    d = collections.defaultdict(list)
    min_b = 10**9
    max_p = 0
    for v in a:
        p = v - min_b
        max_p = max(max_p, p)
        d[p] += [min_b]
        min_b = min(min_b, v)
    print((len(d[max_p])))


if __name__ == "__main__":
    slove()

-    b = collections.defaultdict(list) -    m_c = 10**9 -    for i, v in enumerate(a): -        if i != 0 and m_c < v: -            b[v - m_c] += [m_c] -        m_c = min(m_c, v) -    b = sorted(list(b.items()), reverse=True)[0] -    print((len(collections.Counter(b[1])))) +    d = collections.defaultdict(list) +    min_b = 10**9 +    max_p = 0 +    for v in a: +        p = v - min_b +        max_p = max(max_p, p) +        d[p] += [min_b] +        min_b = min(min_b, v) +    print((len(d[max_p])))