fun main(args: Array<String>) {

    val (n, k) = readLine()!!.split(" ").map(String::toInt)
    val an = readLine()!!.split(" ").map(String::toInt)
        .groupBy { it }
        .mapValues { it.value.size }
        .toList()
        .sortedByDescending { it.second }

    an.drop(k).sumBy { it.second }.let(::println)
}


