"use strict"
function Main(input) {
  input = input.split('\n');
  let i1 = input[0].trim().split(' ').map(Number);
  let n = i1[0];
  let k = i1[1];

  if(n===k) {
    console.log(0)
    return;
  }

  let mons = input[1].trim().split(' ').map(Number);
  mons.sort((a,b) => a<b? 1:-1);
  let t = mons.slice(k);
 
  let atk = t.reduce((acc, val) => {
    return acc+=val;
  })
 
  console.log(atk)
}
Main(require("fs").readFileSync("/dev/stdin", "utf8"));