Scanf.(Array.(
  scanf" %d %d"@@fun n t->
    init n(fun _->scanf" %d"@@fun v->v)
    |> to_list |> List.rev |> of_list
    |> fold_left (fun (mx,u,c) v ->
      if mx<v then (v,u,c)
      else let w = mx-v in
        if w>u then (mx,w,1)
        else if w=u then (mx,u,c+1)
        else (mx,u,c)
    ) (0,0,0)
    |> (fun (_,_,c) -> print_int c)))