import CoreFoundation

let arr = readLine()!.characters.split{$0==" "}.map{Int(String($0))!}
let n = arr[0]
let k = arr[1]

var i: Int = 0
var ret: Int = 0

var h = readLine()!.characters.split{$0==" "}.map{Int(String($0))!}
var sumH: Int = 0

h.forEach { sumH += $0 }

h = h.sort{$0>$1}

if( k >= h.count ) {
  print(0)
  exit(0)
}


for i in 0..<k {
  sumH -= h[i]
}

print(sumH)