"use strict";
function main(input) {
  let kari = input[0].trim().split(" ");
  let kari3 = input[1].trim().split(" ");

  let kari2 = kari.map(i => parseInt(i));
  let h = kari3.map(i => parseInt(i));
  h.sort(function(a, b) {
    return b-a;
  });

  let n = kari2[0];
  let k = kari2[1];

  if(k<=n){
    let sum = 0;
    for(let i=k;i<n;i++){
      sum += h[i];
    }
    console.log(sum);
  }else{
    console.log(0);
  }
}
main(require('fs').readFileSync('/dev/stdin', 'utf8').trim().split("\n"));