from itertools import combinations

N,T=[int(x) for x in input().split()]
towns=list([int(x) for x in input().split()])

com=combinations(list(range(0,N)),2)

bene=[]
for c in com:
    bene.append(towns[c[1]]-towns[c[0]])

max_bene=max(bene)
print(len([item for item in [x for x in bene if x==max_bene]]))