object Main extends App {
  val sc = new java.util.Scanner(System.in)
  val n, k = sc.nextInt()
  val as = List.fill(n)(sc.nextInt()-1)

  val count = Array.fill(n)(0)

  for (a <- as) {
    count(a) += 1
  }

  val ans = count.sorted.reverse.drop(k).sum
  println(ans)
}
