object Main extends App {
  val sc = new java.util.Scanner(System.in)
  val n, k = sc.nextInt()
  val a = List.fill(n)(sc.nextInt())
  val ans = a.groupBy(identity).values.toList.map(_.length).sorted.reverse.drop(k).sum
  println(ans)
}
