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

public class Main {
	public static void main(String[] args) {
		Scanner input = new Scanner(System.in);
		int n = input.nextInt();
		int k = input.nextInt();
		long [] h = new long[n];
		long s = 0;
		for (int i = 0; i < n; i++) {
			h[i] = input.nextLong();
		}
		if (k >= n) {
			System.out.println(0);
		}else {
			Arrays.sort(h);
			for(int i = 0; i < n-k ;i++) {
				s += h[i]; 
			}
			System.out.printf("%d",s);
		}
		
	}
} import java.util.Arrays; Arrays java.util import java.util.Scanner; Scanner java.util public class Main {
	public static void main(String[] args) {
		Scanner input = new Scanner(System.in);
		int n = input.nextInt();
		int k = input.nextInt();
		long [] h = new long[n];
		long s = 0;
		for (int i = 0; i < n; i++) {
			h[i] = input.nextLong();
		}
		if (k >= n) {
			System.out.println(0);
		}else {
			Arrays.sort(h);
			for(int i = 0; i < n-k ;i++) {
				s += h[i]; 
			}
			System.out.printf("%d",s);
		}
		
	}
} Main public static void main(String[] args) {
		Scanner input = new Scanner(System.in);
		int n = input.nextInt();
		int k = input.nextInt();
		long [] h = new long[n];
		long s = 0;
		for (int i = 0; i < n; i++) {
			h[i] = input.nextLong();
		}
		if (k >= n) {
			System.out.println(0);
		}else {
			Arrays.sort(h);
			for(int i = 0; i < n-k ;i++) {
				s += h[i]; 
			}
			System.out.printf("%d",s);
		}
		
	} main {
		Scanner input = new Scanner(System.in);
		int n = input.nextInt();
		int k = input.nextInt();
		long [] h = new long[n];
		long s = 0;
		for (int i = 0; i < n; i++) {
			h[i] = input.nextLong();
		}
		if (k >= n) {
			System.out.println(0);
		}else {
			Arrays.sort(h);
			for(int i = 0; i < n-k ;i++) {
				s += h[i]; 
			}
			System.out.printf("%d",s);
		}
		
	} Scanner input = new Scanner(System.in); input new Scanner(System.in) int n = input.nextInt(); n input.nextInt() input.nextInt input int k = input.nextInt(); k input.nextInt() input.nextInt input long [] h = new long[n]; h new long[n] n long s = 0; s 0 for (int i = 0; i < n; i++) {
			h[i] = input.nextLong();
		} int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
			h[i] = input.nextLong();
		} {
			h[i] = input.nextLong();
		} h[i] = input.nextLong() h[i] h i input.nextLong() input.nextLong input if (k >= n) {
			System.out.println(0);
		}else {
			Arrays.sort(h);
			for(int i = 0; i < n-k ;i++) {
				s += h[i]; 
			}
			System.out.printf("%d",s);
		} k >= n k n {
			System.out.println(0);
		} System.out.println(0) System.out.println System.out System System.out 0 {
			Arrays.sort(h);
			for(int i = 0; i < n-k ;i++) {
				s += h[i]; 
			}
			System.out.printf("%d",s);
		} Arrays.sort(h) Arrays.sort Arrays h for(int i = 0; i < n-k ;i++) {
				s += h[i]; 
			} int i = 0; int i = 0; i 0 i < n-k i n-k n k i++ i++ i {
				s += h[i]; 
			} {
				s += h[i]; 
			} s += h[i] s h[i] h i System.out.printf("%d",s) System.out.printf System.out System System.out "%d" s String[] args args public class Main {
	public static void main(String[] args) {
		Scanner input = new Scanner(System.in);
		int n = input.nextInt();
		int k = input.nextInt();
		long [] h = new long[n];
		long s = 0;
		for (int i = 0; i < n; i++) {
			h[i] = input.nextLong();
		}
		if (k >= n) {
			System.out.println(0);
		}else {
			Arrays.sort(h);
			for(int i = 0; i < n-k ;i++) {
				s += h[i]; 
			}
			System.out.printf("%d",s);
		}
		
	}
} public class Main {
	public static void main(String[] args) {
		Scanner input = new Scanner(System.in);
		int n = input.nextInt();
		int k = input.nextInt();
		long [] h = new long[n];
		long s = 0;
		for (int i = 0; i < n; i++) {
			h[i] = input.nextLong();
		}
		if (k >= n) {
			System.out.println(0);
		}else {
			Arrays.sort(h);
			for(int i = 0; i < n-k ;i++) {
				s += h[i]; 
			}
			System.out.printf("%d",s);
		}
		
	}
} Main
import java.util.Arrays;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner input = new Scanner(System.in);
		int n = input.nextInt();
		int k = input.nextInt();
		long [] h = new long[n];
		long s = 0;
		for (int i = 0; i < n; i++) {
			h[i] = input.nextLong();
		}
		if (k >= n) {
			System.out.println(0);
		}else {
			Arrays.sort(h);
			for(int i = 0; i < n-k ;i++) {
				s += h[i]; 
			}
			System.out.printf("%d",s);
		}
		
	}
}