import scala.io.StdIn

object Main extends App {

  val Array(n, k) = StdIn.readLine.split(" ").map(_.toInt)
  val seq = StdIn.readLine.split(" ").map(_.toInt)
    .groupBy(m => m).map(_._2.size).toArray.sorted
  val g = math.max(seq.size - k, 0)
  val ans = seq.take(g).sum
  
  println(ans)
}