let split_string ?(pattern="") = Str.split @@ Str.regexp pattern
let n, k = Scanf.sscanf (read_line ()) "%d %d" @@ fun n k -> (n, k)
let a = read_line () |> split_string ~pattern:" " |> List.map int_of_string

module IntMap = Map.Make(struct type t = int let compare = compare end)

let map = List.fold_left (fun map i ->
  let cnt = try IntMap.find i map with Not_found -> 0 in
  IntMap.add i (cnt + 1) map
) IntMap.empty a

let rec drop n acc = match (n, acc) with
  | (0, acc) -> acc
  | (_, []) -> []
  | (n, x :: xs) -> drop (n - 1) xs

let () =
  IntMap.bindings map
  |> List.sort (fun (_, a) (_, b) -> b - a)
  |> drop k
  |> List.map snd
  |> List.fold_left (+) 0
  |> Printf.printf "%d\n"