(* O(n log n) *)
Scanf.scanf " %d %d" @@ fun n k ->
  let balls = Array.make n 0 in
  for i = 1 to n do
    let a = Scanf.scanf " %d" @@ (+) 0 in
    balls.(a - 1) <- balls.(a - 1) + 1
  done;
  Array.sort (-) balls;
  Array.sub balls 0 @@ n - k |> Array.fold_left (+) 0 |> Printf.printf "%d\n"