import java.util.*;
import java.util.Map.Entry;
 
 
 class Main {
	 static int mod =  (int) (Math.pow(10,9)+7);
	 static List<ArrayList<Integer>>  list = new ArrayList<ArrayList<Integer>>();
    public static void main(String[] args) {
    
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int K = sc.nextInt();
        long[] H = new long[N];
        long sum=0;
        for(int i=0;i<N;i++) {
        	H[i]=sc.nextLong();
        }
        
        Arrays.sort(H);
        
        for(int i=0;i<N-K;i++) {
        	sum=sum+H[i];
        }

        System.out.println(sum);
        		
    }
} import java.util.*; util.* java import java.util.Map.Entry; Entry java.util.Map class Main {
	 static int mod =  (int) (Math.pow(10,9)+7);
	 static List<ArrayList<Integer>>  list = new ArrayList<ArrayList<Integer>>();
    public static void main(String[] args) {
    
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int K = sc.nextInt();
        long[] H = new long[N];
        long sum=0;
        for(int i=0;i<N;i++) {
        	H[i]=sc.nextLong();
        }
        
        Arrays.sort(H);
        
        for(int i=0;i<N-K;i++) {
        	sum=sum+H[i];
        }

        System.out.println(sum);
        		
    }
} Main static int mod =  (int) (Math.pow(10,9)+7); mod (int) (Math.pow(10,9)+7) Math.pow(10,9) Math.pow Math 10 9 7 static List<ArrayList<Integer>>  list = new ArrayList<ArrayList<Integer>>(); list new ArrayList<ArrayList<Integer>>() public static void main(String[] args) {
    
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int K = sc.nextInt();
        long[] H = new long[N];
        long sum=0;
        for(int i=0;i<N;i++) {
        	H[i]=sc.nextLong();
        }
        
        Arrays.sort(H);
        
        for(int i=0;i<N-K;i++) {
        	sum=sum+H[i];
        }

        System.out.println(sum);
        		
    } main {
    
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int K = sc.nextInt();
        long[] H = new long[N];
        long sum=0;
        for(int i=0;i<N;i++) {
        	H[i]=sc.nextLong();
        }
        
        Arrays.sort(H);
        
        for(int i=0;i<N-K;i++) {
        	sum=sum+H[i];
        }

        System.out.println(sum);
        		
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int N = sc.nextInt(); N sc.nextInt() sc.nextInt sc int K = sc.nextInt(); K sc.nextInt() sc.nextInt sc long[] H = new long[N]; H new long[N] N long sum=0; sum 0 for(int i=0;i<N;i++) {
        	H[i]=sc.nextLong();
        } int i=0; int i=0; i 0 i<N i N i++ i++ i {
        	H[i]=sc.nextLong();
        } {
        	H[i]=sc.nextLong();
        } H[i]=sc.nextLong() H[i] H i sc.nextLong() sc.nextLong sc Arrays.sort(H) Arrays.sort Arrays H for(int i=0;i<N-K;i++) {
        	sum=sum+H[i];
        } int i=0; int i=0; i 0 i<N-K i N-K N K i++ i++ i {
        	sum=sum+H[i];
        } {
        	sum=sum+H[i];
        } sum=sum+H[i] sum sum+H[i] sum H[i] H i System.out.println(sum) System.out.println System.out System System.out sum String[] args args
import java.util.*;
import java.util.Map.Entry;
 
 
 class Main {
	 static int mod =  (int) (Math.pow(10,9)+7);
	 static List<ArrayList<Integer>>  list = new ArrayList<ArrayList<Integer>>();
    public static void main(String[] args) {
    
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int K = sc.nextInt();
        long[] H = new long[N];
        long sum=0;
        for(int i=0;i<N;i++) {
        	H[i]=sc.nextLong();
        }
        
        Arrays.sort(H);
        
        for(int i=0;i<N-K;i++) {
        	sum=sum+H[i];
        }

        System.out.println(sum);
        		
    }
}