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) in
  for i = n - 2 downto 0 do
    maximum.(i) <- max as_.(i) maximum.(i + 1)
  done;
  Array.mapi (fun i a -> maximum.(i) - a) as_
  |> Array.fold_left (fun (maximum, c) d ->
      max d maximum,
        match compare d maximum with
        | -1 -> c
        | 0 ->  1 + c
        | 1 ->  1) (min_int, 0)
  |> snd
  |> Printf.printf "%d\n"