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

public class Main {

	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		int N = scanner.nextInt();
		int K = scanner.nextInt();
		int[] H = new int[N];
		for (int i = 0; i < N; i++) {
			H[i] = scanner.nextInt();
		}
		Arrays.parallelSort(H);
		long result = 0;
		for (int i = 0; i < N - K; i++) {
			result += H[i];
		}
		System.out.println(result);

	}

} import java.util.Arrays; Arrays java.util import java.util.Scanner; Scanner java.util public class Main {

	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		int N = scanner.nextInt();
		int K = scanner.nextInt();
		int[] H = new int[N];
		for (int i = 0; i < N; i++) {
			H[i] = scanner.nextInt();
		}
		Arrays.parallelSort(H);
		long result = 0;
		for (int i = 0; i < N - K; i++) {
			result += H[i];
		}
		System.out.println(result);

	}

} Main public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		int N = scanner.nextInt();
		int K = scanner.nextInt();
		int[] H = new int[N];
		for (int i = 0; i < N; i++) {
			H[i] = scanner.nextInt();
		}
		Arrays.parallelSort(H);
		long result = 0;
		for (int i = 0; i < N - K; i++) {
			result += H[i];
		}
		System.out.println(result);

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

	} Scanner scanner = new Scanner(System.in); scanner new Scanner(System.in) int N = scanner.nextInt(); N scanner.nextInt() scanner.nextInt scanner int K = scanner.nextInt(); K scanner.nextInt() scanner.nextInt scanner int[] H = new int[N]; H new int[N] N for (int i = 0; i < N; i++) {
			H[i] = scanner.nextInt();
		} int i = 0; int i = 0; i 0 i < N i N i++ i++ i {
			H[i] = scanner.nextInt();
		} {
			H[i] = scanner.nextInt();
		} H[i] = scanner.nextInt() H[i] H i scanner.nextInt() scanner.nextInt scanner Arrays.parallelSort(H) Arrays.parallelSort Arrays H long result = 0; result 0 for (int i = 0; i < N - K; i++) {
			result += H[i];
		} int i = 0; int i = 0; i 0 i < N - K i N - K N K i++ i++ i {
			result += H[i];
		} {
			result += H[i];
		} result += H[i] result H[i] H i System.out.println(result) System.out.println System.out System System.out result String[] args args public class Main {

	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		int N = scanner.nextInt();
		int K = scanner.nextInt();
		int[] H = new int[N];
		for (int i = 0; i < N; i++) {
			H[i] = scanner.nextInt();
		}
		Arrays.parallelSort(H);
		long result = 0;
		for (int i = 0; i < N - K; i++) {
			result += H[i];
		}
		System.out.println(result);

	}

} public class Main {

	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		int N = scanner.nextInt();
		int K = scanner.nextInt();
		int[] H = new int[N];
		for (int i = 0; i < N; i++) {
			H[i] = scanner.nextInt();
		}
		Arrays.parallelSort(H);
		long result = 0;
		for (int i = 0; i < N - K; i++) {
			result += H[i];
		}
		System.out.println(result);

	}

} Main
import java.util.Arrays;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		int N = scanner.nextInt();
		int K = scanner.nextInt();
		int[] H = new int[N];
		for (int i = 0; i < N; i++) {
			H[i] = scanner.nextInt();
		}
		Arrays.parallelSort(H);
		long result = 0;
		for (int i = 0; i < N - K; i++) {
			result += H[i];
		}
		System.out.println(result);

	}

}
