import java.util.*;

class Main {
	Scanner sc;
	
	private void calc() {
		sc = new Scanner(System.in);
		int N = sc.nextInt();
		int K = sc.nextInt();
		int[] H = new int[N];
		for (int i = 0; i < N; i++) {
			H[i] = sc.nextInt();
		}
		Arrays.sort(H);
		long s = 0;
		for (int i = 0; i < N-K; i++) {
			s += H[i];
		}
		System.out.println(s);
	}

	public static void main(String[] args) {
		new Main().calc();
	}
} import java.util.*; util.* java class Main {
	Scanner sc;
	
	private void calc() {
		sc = new Scanner(System.in);
		int N = sc.nextInt();
		int K = sc.nextInt();
		int[] H = new int[N];
		for (int i = 0; i < N; i++) {
			H[i] = sc.nextInt();
		}
		Arrays.sort(H);
		long s = 0;
		for (int i = 0; i < N-K; i++) {
			s += H[i];
		}
		System.out.println(s);
	}

	public static void main(String[] args) {
		new Main().calc();
	}
} Main Scanner sc; sc private void calc() {
		sc = new Scanner(System.in);
		int N = sc.nextInt();
		int K = sc.nextInt();
		int[] H = new int[N];
		for (int i = 0; i < N; i++) {
			H[i] = sc.nextInt();
		}
		Arrays.sort(H);
		long s = 0;
		for (int i = 0; i < N-K; i++) {
			s += H[i];
		}
		System.out.println(s);
	} calc {
		sc = new Scanner(System.in);
		int N = sc.nextInt();
		int K = sc.nextInt();
		int[] H = new int[N];
		for (int i = 0; i < N; i++) {
			H[i] = sc.nextInt();
		}
		Arrays.sort(H);
		long s = 0;
		for (int i = 0; i < N-K; i++) {
			s += H[i];
		}
		System.out.println(s);
	} 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 int[] H = new int[N]; H new int[N] N for (int i = 0; i < N; i++) {
			H[i] = sc.nextInt();
		} int i = 0; int i = 0; i 0 i < N i N i++ i++ i {
			H[i] = sc.nextInt();
		} {
			H[i] = sc.nextInt();
		} H[i] = sc.nextInt() H[i] H i sc.nextInt() sc.nextInt sc Arrays.sort(H) Arrays.sort Arrays H long s = 0; s 0 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.println(s) System.out.println System.out System System.out s public static void main(String[] args) {
		new Main().calc();
	} main {
		new Main().calc();
	} new Main().calc() new Main().calc new Main() String[] args args
import java.util.*;

class Main {
	Scanner sc;
	
	private void calc() {
		sc = new Scanner(System.in);
		int N = sc.nextInt();
		int K = sc.nextInt();
		int[] H = new int[N];
		for (int i = 0; i < N; i++) {
			H[i] = sc.nextInt();
		}
		Arrays.sort(H);
		long s = 0;
		for (int i = 0; i < N-K; i++) {
			s += H[i];
		}
		System.out.println(s);
	}

	public static void main(String[] args) {
		new Main().calc();
	}
}
