inp = require('fs').readFileSync('/dev/stdin', 'utf8').trim().split('\n')
l = inp.shift().split(' ')
N = l.shift() * 1
K = l.shift() * 1 
H = inp.shift().split(' ').map(x => x - 0).sort((a,b) => a - b).slice(0, N > K ? N - K : 0).reduce(((c, a) => a + c), 0)
console.log(H)