fun main(args: Array<String>) = yorukatsu20c()

fun yorukatsu20c() {
    val (n, k) = readLine()!!.split(' ').map { it.toInt() }
    val aList = readLine()!!.split(' ').map { it.toInt() }

    val answer = aList.asSequence()
        .groupBy { it }.map { it.value.size }.sortedDescending().drop(k).sum()

    println(answer)
}
