local mmi, mma = math.min, math.max
local n, t = io.read("*n", "*n")
local a = {}
for i = 1, n do
  a[i] = io.read("*n")
end
local maxdiff = 0
local maxdiff_cnt = 0
local curmin = a[1]
for i = 2, n do
  if curmin < a[i] then
    if maxdiff < a[i] - curmin then
      maxdiff = a[i] - curmin
      maxdiff_cnt = 1
    elseif maxdiff == a[i] - curmin then
      maxdiff_cnt = maxdiff_cnt + 1
    end
  end
  curmin = mmi(curmin, a[i])
end
print(maxdiff_cnt)
