import java.io.*;
import java.util.*;

public class Main implements Runnable{
 StreamTokenizer in;
 BufferedReader bin;
 PrintWriter out;
 public static void main(String[] args){
  new Thread(new Main()).start();
 }
 public void run(){
  try{
   bin=new BufferedReader(new FileReader("A.in"));
   in=new StreamTokenizer(bin);
   out=new PrintWriter(new FileWriter("A.out"));
   Locale.setDefault(Locale.US);
   solve();
   out.flush();
  }catch(IOException ex){
   throw new IllegalStateException(ex);
  }
 }
 int nextInt() throws IOException{
  in.nextToken();
  return (int)in.nval;
 }
 void solve() throws IOException{
  int n=nextInt();
  int k=nextInt();
  int a[]=new int[100005];
  for(int i=0;i<n;i++)
   a[nextInt()]++;
  int s=0,si=0;
  for(int i=100004;i>=0;i--)
   if(a[i]>0){
    while(a[i]>0){
     if(si+1<=n-k){
      si++;
      s+=i;
      a[i]--;
     }else 
      break;
    }
    if(si+1>n-k)
     break;
   }
  out.println(s);
 }
}