import java.util.*;
import java.io.PrintWriter;
import static java.lang.Integer.*;
import static java.lang.Long.*;
import static java.lang.Math.*;
import static java.lang.System.*;

public class Main {
	public static final int MOD = 1000000007;
	public static ArrayList<Integer> list = new ArrayList<>();
	public static void main(String[] args) {
		int i,j;
		Scanner sc = new Scanner(in);
		int n = parseInt(sc.next());
		int k = parseInt(sc.next());
		long[] h = new long[n];
		for (i = 0; i < h.length; i++) {
			h[i] = parseInt(sc.next());
		}
		sc.close();
		Arrays.parallelSort(h);
		long sum=0;
		for (i = n-k-1; i >= 0; i--) {
			sum+=h[i];
		}
		out.println(sum);
	}
} import java.util.*; util.* java import java.io.PrintWriter; PrintWriter java.io import static java.lang.Integer.*; import static java.lang.Integer.*; import static java.lang.Integer.*; import static java.lang.Long.*; import static java.lang.Long.*; import static java.lang.Long.*; import static java.lang.Math.*; import static java.lang.Math.*; import static java.lang.Math.*; import static java.lang.System.*; import static java.lang.System.*; import static java.lang.System.*; public class Main {
	public static final int MOD = 1000000007;
	public static ArrayList<Integer> list = new ArrayList<>();
	public static void main(String[] args) {
		int i,j;
		Scanner sc = new Scanner(in);
		int n = parseInt(sc.next());
		int k = parseInt(sc.next());
		long[] h = new long[n];
		for (i = 0; i < h.length; i++) {
			h[i] = parseInt(sc.next());
		}
		sc.close();
		Arrays.parallelSort(h);
		long sum=0;
		for (i = n-k-1; i >= 0; i--) {
			sum+=h[i];
		}
		out.println(sum);
	}
} Main public static final int MOD = 1000000007; MOD 1000000007 public static ArrayList<Integer> list = new ArrayList<>(); list new ArrayList<>() public static void main(String[] args) {
		int i,j;
		Scanner sc = new Scanner(in);
		int n = parseInt(sc.next());
		int k = parseInt(sc.next());
		long[] h = new long[n];
		for (i = 0; i < h.length; i++) {
			h[i] = parseInt(sc.next());
		}
		sc.close();
		Arrays.parallelSort(h);
		long sum=0;
		for (i = n-k-1; i >= 0; i--) {
			sum+=h[i];
		}
		out.println(sum);
	} main {
		int i,j;
		Scanner sc = new Scanner(in);
		int n = parseInt(sc.next());
		int k = parseInt(sc.next());
		long[] h = new long[n];
		for (i = 0; i < h.length; i++) {
			h[i] = parseInt(sc.next());
		}
		sc.close();
		Arrays.parallelSort(h);
		long sum=0;
		for (i = n-k-1; i >= 0; i--) {
			sum+=h[i];
		}
		out.println(sum);
	} int i i j; j Scanner sc = new Scanner(in); sc new Scanner(in) int n = parseInt(sc.next()); n parseInt(sc.next()) parseInt sc.next() sc.next sc int k = parseInt(sc.next()); k parseInt(sc.next()) parseInt sc.next() sc.next sc long[] h = new long[n]; h new long[n] n for (i = 0; i < h.length; i++) {
			h[i] = parseInt(sc.next());
		} i = 0; i = 0 i 0 i < h.length i h.length h h.length i++ i++ i {
			h[i] = parseInt(sc.next());
		} {
			h[i] = parseInt(sc.next());
		} h[i] = parseInt(sc.next()) h[i] h i parseInt(sc.next()) parseInt sc.next() sc.next sc sc.close() sc.close sc Arrays.parallelSort(h) Arrays.parallelSort Arrays h long sum=0; sum 0 for (i = n-k-1; i >= 0; i--) {
			sum+=h[i];
		} i = n-k-1; i = n-k-1 i n-k-1 n-k-1 n k 1 i >= 0 i 0 i-- i-- i {
			sum+=h[i];
		} {
			sum+=h[i];
		} sum+=h[i] sum h[i] h i out.println(sum) out.println out sum String[] args args public class Main {
	public static final int MOD = 1000000007;
	public static ArrayList<Integer> list = new ArrayList<>();
	public static void main(String[] args) {
		int i,j;
		Scanner sc = new Scanner(in);
		int n = parseInt(sc.next());
		int k = parseInt(sc.next());
		long[] h = new long[n];
		for (i = 0; i < h.length; i++) {
			h[i] = parseInt(sc.next());
		}
		sc.close();
		Arrays.parallelSort(h);
		long sum=0;
		for (i = n-k-1; i >= 0; i--) {
			sum+=h[i];
		}
		out.println(sum);
	}
} public class Main {
	public static final int MOD = 1000000007;
	public static ArrayList<Integer> list = new ArrayList<>();
	public static void main(String[] args) {
		int i,j;
		Scanner sc = new Scanner(in);
		int n = parseInt(sc.next());
		int k = parseInt(sc.next());
		long[] h = new long[n];
		for (i = 0; i < h.length; i++) {
			h[i] = parseInt(sc.next());
		}
		sc.close();
		Arrays.parallelSort(h);
		long sum=0;
		for (i = n-k-1; i >= 0; i--) {
			sum+=h[i];
		}
		out.println(sum);
	}
} Main
import java.util.*;
import java.io.PrintWriter;
import static java.lang.Integer.*;
import static java.lang.Long.*;
import static java.lang.Math.*;
import static java.lang.System.*;

public class Main {
	public static final int MOD = 1000000007;
	public static ArrayList<Integer> list = new ArrayList<>();
	public static void main(String[] args) {
		int i,j;
		Scanner sc = new Scanner(in);
		int n = parseInt(sc.next());
		int k = parseInt(sc.next());
		long[] h = new long[n];
		for (i = 0; i < h.length; i++) {
			h[i] = parseInt(sc.next());
		}
		sc.close();
		Arrays.parallelSort(h);
		long sum=0;
		for (i = n-k-1; i >= 0; i--) {
			sum+=h[i];
		}
		out.println(sum);
	}
}
