import java.util.Arrays;
import java.util.Scanner;

public class Main {
	public static void main(String[]args) {
		try(Scanner scan = new Scanner(System.in)){
			int N = scan.nextInt();
			int K = scan.nextInt();
			
			int[] H = new int[N];
			//ArrayList<Integer> hp  = new ArrayList<Integer>();
			
			
			for(int i = 0;i<N;i++) {
				H[i] = scan.nextInt();
			}
			
			Arrays.sort(H);
			
			
			
			
			if(N<=K) {//必殺技だけで全員倒せる
				System.out.println(0);
			}else{
				long kaisuu = 0;
				for(int i = 0;i<N-K;i++) {
					kaisuu +=(long)H[i];
				}
				
				
				
				System.out.println(kaisuu);
			}
        }
    }
}
			
			
			
			
			
			 import java.util.Arrays; Arrays java.util import java.util.Scanner; Scanner java.util public class Main {
	public static void main(String[]args) {
		try(Scanner scan = new Scanner(System.in)){
			int N = scan.nextInt();
			int K = scan.nextInt();
			
			int[] H = new int[N];
			//ArrayList<Integer> hp  = new ArrayList<Integer>();
			
			
			for(int i = 0;i<N;i++) {
				H[i] = scan.nextInt();
			}
			
			Arrays.sort(H);
			
			
			
			
			if(N<=K) {//必殺技だけで全員倒せる
				System.out.println(0);
			}else{
				long kaisuu = 0;
				for(int i = 0;i<N-K;i++) {
					kaisuu +=(long)H[i];
				}
				
				
				
				System.out.println(kaisuu);
			}
        }
    }
} Main public static void main(String[]args) {
		try(Scanner scan = new Scanner(System.in)){
			int N = scan.nextInt();
			int K = scan.nextInt();
			
			int[] H = new int[N];
			//ArrayList<Integer> hp  = new ArrayList<Integer>();
			
			
			for(int i = 0;i<N;i++) {
				H[i] = scan.nextInt();
			}
			
			Arrays.sort(H);
			
			
			
			
			if(N<=K) {//必殺技だけで全員倒せる
				System.out.println(0);
			}else{
				long kaisuu = 0;
				for(int i = 0;i<N-K;i++) {
					kaisuu +=(long)H[i];
				}
				
				
				
				System.out.println(kaisuu);
			}
        }
    } main {
		try(Scanner scan = new Scanner(System.in)){
			int N = scan.nextInt();
			int K = scan.nextInt();
			
			int[] H = new int[N];
			//ArrayList<Integer> hp  = new ArrayList<Integer>();
			
			
			for(int i = 0;i<N;i++) {
				H[i] = scan.nextInt();
			}
			
			Arrays.sort(H);
			
			
			
			
			if(N<=K) {//必殺技だけで全員倒せる
				System.out.println(0);
			}else{
				long kaisuu = 0;
				for(int i = 0;i<N-K;i++) {
					kaisuu +=(long)H[i];
				}
				
				
				
				System.out.println(kaisuu);
			}
        }
    } try(Scanner scan = new Scanner(System.in)){
			int N = scan.nextInt();
			int K = scan.nextInt();
			
			int[] H = new int[N];
			//ArrayList<Integer> hp  = new ArrayList<Integer>();
			
			
			for(int i = 0;i<N;i++) {
				H[i] = scan.nextInt();
			}
			
			Arrays.sort(H);
			
			
			
			
			if(N<=K) {//必殺技だけで全員倒せる
				System.out.println(0);
			}else{
				long kaisuu = 0;
				for(int i = 0;i<N-K;i++) {
					kaisuu +=(long)H[i];
				}
				
				
				
				System.out.println(kaisuu);
			}
        } {
			int N = scan.nextInt();
			int K = scan.nextInt();
			
			int[] H = new int[N];
			//ArrayList<Integer> hp  = new ArrayList<Integer>();
			
			
			for(int i = 0;i<N;i++) {
				H[i] = scan.nextInt();
			}
			
			Arrays.sort(H);
			
			
			
			
			if(N<=K) {//必殺技だけで全員倒せる
				System.out.println(0);
			}else{
				long kaisuu = 0;
				for(int i = 0;i<N-K;i++) {
					kaisuu +=(long)H[i];
				}
				
				
				
				System.out.println(kaisuu);
			}
        } Scanner scan = new Scanner(System.in) Scanner scan = new Scanner(System.in) new Scanner(System.in) int N = scan.nextInt(); N scan.nextInt() scan.nextInt scan int K = scan.nextInt(); K scan.nextInt() scan.nextInt scan int[] H = new int[N]; H new int[N] N for(int i = 0;i<N;i++) {
				H[i] = scan.nextInt();
			} int i = 0; int i = 0; i 0 i<N i N i++ i++ i {
				H[i] = scan.nextInt();
			} {
				H[i] = scan.nextInt();
			} H[i] = scan.nextInt() H[i] H i scan.nextInt() scan.nextInt scan Arrays.sort(H) Arrays.sort Arrays H if(N<=K) {//必殺技だけで全員倒せる
				System.out.println(0);
			}else{
				long kaisuu = 0;
				for(int i = 0;i<N-K;i++) {
					kaisuu +=(long)H[i];
				}
				
				
				
				System.out.println(kaisuu);
			} N<=K N K {//必殺技だけで全員倒せる
				System.out.println(0);
			} System.out.println(0) System.out.println System.out System System.out 0 {
				long kaisuu = 0;
				for(int i = 0;i<N-K;i++) {
					kaisuu +=(long)H[i];
				}
				
				
				
				System.out.println(kaisuu);
			} long kaisuu = 0; kaisuu 0 for(int i = 0;i<N-K;i++) {
					kaisuu +=(long)H[i];
				} int i = 0; int i = 0; i 0 i<N-K i N-K N K i++ i++ i {
					kaisuu +=(long)H[i];
				} {
					kaisuu +=(long)H[i];
				} kaisuu +=(long)H[i] kaisuu (long)H[i] H i System.out.println(kaisuu) System.out.println System.out System System.out kaisuu String[]args args public class Main {
	public static void main(String[]args) {
		try(Scanner scan = new Scanner(System.in)){
			int N = scan.nextInt();
			int K = scan.nextInt();
			
			int[] H = new int[N];
			//ArrayList<Integer> hp  = new ArrayList<Integer>();
			
			
			for(int i = 0;i<N;i++) {
				H[i] = scan.nextInt();
			}
			
			Arrays.sort(H);
			
			
			
			
			if(N<=K) {//必殺技だけで全員倒せる
				System.out.println(0);
			}else{
				long kaisuu = 0;
				for(int i = 0;i<N-K;i++) {
					kaisuu +=(long)H[i];
				}
				
				
				
				System.out.println(kaisuu);
			}
        }
    }
} public class Main {
	public static void main(String[]args) {
		try(Scanner scan = new Scanner(System.in)){
			int N = scan.nextInt();
			int K = scan.nextInt();
			
			int[] H = new int[N];
			//ArrayList<Integer> hp  = new ArrayList<Integer>();
			
			
			for(int i = 0;i<N;i++) {
				H[i] = scan.nextInt();
			}
			
			Arrays.sort(H);
			
			
			
			
			if(N<=K) {//必殺技だけで全員倒せる
				System.out.println(0);
			}else{
				long kaisuu = 0;
				for(int i = 0;i<N-K;i++) {
					kaisuu +=(long)H[i];
				}
				
				
				
				System.out.println(kaisuu);
			}
        }
    }
} Main
import java.util.Arrays;
import java.util.Scanner;

public class Main {
	public static void main(String[]args) {
		try(Scanner scan = new Scanner(System.in)){
			int N = scan.nextInt();
			int K = scan.nextInt();
			
			int[] H = new int[N];
			//ArrayList<Integer> hp  = new ArrayList<Integer>();
			
			
			for(int i = 0;i<N;i++) {
				H[i] = scan.nextInt();
			}
			
			Arrays.sort(H);
			
			
			
			
			if(N<=K) {//必殺技だけで全員倒せる
				System.out.println(0);
			}else{
				long kaisuu = 0;
				for(int i = 0;i<N-K;i++) {
					kaisuu +=(long)H[i];
				}
				
				
				
				System.out.println(kaisuu);
			}
        }
    }
}
			
			
			
			
			
			