import java.util.*

fun main(args: Array<String>) {
    val (n, k) = readLine()!!.split(" ").map { it.toLong() }
    val h = readLine()!!.split(" ").map { it.toLong() }

    if(n <= k){
        println(0)
        return
    }
    var sum = h.sortedDescending().takeLast((n-k).toInt()).sum()
    println(sum)
}