let () = Scanf.scanf "%d %d\n" @@ fun n t ->
  let as_ = Array.init n @@ fun _ -> Scanf.scanf "%d " @@ fun a -> a in
  let maximum = Array.make n (as_.(n - 1), n - 1) in
  for i = n - 2 downto 0 do
    maximum.(i) <-
      if as_.(i) < fst maximum.(i + 1) then maximum.(i + 1)
      else (as_.(i), i)
  done;
  Array.to_list as_
  |> List.mapi (fun i a -> (fst maximum.(i) - a, snd maximum.(i)))
  |> List.fold_left (fun (maximum, is) (d, i) ->
      match compare d maximum with
      | -1 -> (maximum, is)
      | 0 ->  (d, i :: is)
      | 1 ->  (d, [i])) (min_int, [])
  |> snd
  |> List.sort_uniq compare
  |> List.length
  |> Printf.printf "%d\n"