fun main(args: Array<String>) {
        val nk = readLine()!!.split(" ").map { it.toInt() }
        val h = readLine()!!.split(" ").map { it.toInt() }.sortedDescending()

        var count = nk[1]
        var result: Long = 0
        if (h.count() <= count) {
            result = 0
        } else {
            h.forEach { 
                if (count > 0) {
                    count -= 1
                } else {
                    result += it
                }
            }
        }
        print(result.toString())
}