object Main extends App {
  val Array(n,k) = readLine.split(" ").map{_.toInt}
  val a = readLine.split(" ").map{_.toInt}
  val memo = new Array(n)
  a.foreach{v => memo(v) += 1}
  
  val dif = Array(memo.length - k,0).max
  
  println(memo.sorted.take(dif).sum)
}