"use strict";
const Main = (input) =>{
   let xs = input.trim().split('\n');
   let xs1 = xs[0].trim().split(' ').map(v=>parseInt(v,10));
   let xs2 = xs[1].trim().split(' ').map(v=>parseInt(v,10));
   
   const compare = (a, b) =>{
    return b - a;
  }
  
  let ans = xs2.sort(compare);
  let x = xs1[0] - xs1[1];
  
  let count = 0;
  for(let i=0; i<x; i++){
      count += ans[xs1[1]+i];
  }
  console.log(count);
}
Main(require('fs').readFileSync('/dev/stdin','utf8'));