process.stdin.resume();
process.stdin.setEncoding("utf8");
var lines = [];
var reader = require("readline").createInterface({
	input: process.stdin,
	output: process.stdout
});
reader.on("line", (line) => {
	lines.push(line);
});
reader.on("close", () => {
	var e = lines[0].split(" "), n = Number(e[0]), k = Number(e[1]);
	var f = lines[1].split(" "), s = [];
	for(var i=0; i<n;i++){
		s.push(Number(f[i]));
	}

	//配列の最大値を取得して削除 k回行う
	for(var x=0;x<k;x++){
		var max_value = Math.max.apply(null, s);
		var max_index = s.indexOf(max_value);
		s.splice(max_index, 1);
		if(s.length === 0) {
			s.push(0);
			break;
		}
	}

	var sum = s.reduce((a, b) =>a + b);
	console.log(sum);

});
