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

public class Main {

	public static void main(String[] args) {
		// TODO Auto-generated method stub

		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int K = sc.nextInt();
		long ans = 0;
		
		int[] a = new int[N];
		
		for(int i = 0; i < N; i++){
			a[i] = sc.nextInt();
		}
		
		Arrays.sort(a);
		
		if(N >= K){
			for(int i = 0; i < N - K; i++){
				ans = ans + a[i];
			}
		} else {
			ans = 0;
		}
		
		System.out.println(ans);
	}
} import java.util.Arrays; Arrays java.util import java.util.Scanner; Scanner java.util public class Main {

	public static void main(String[] args) {
		// TODO Auto-generated method stub

		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int K = sc.nextInt();
		long ans = 0;
		
		int[] a = new int[N];
		
		for(int i = 0; i < N; i++){
			a[i] = sc.nextInt();
		}
		
		Arrays.sort(a);
		
		if(N >= K){
			for(int i = 0; i < N - K; i++){
				ans = ans + a[i];
			}
		} else {
			ans = 0;
		}
		
		System.out.println(ans);
	}
} Main public static void main(String[] args) {
		// TODO Auto-generated method stub

		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int K = sc.nextInt();
		long ans = 0;
		
		int[] a = new int[N];
		
		for(int i = 0; i < N; i++){
			a[i] = sc.nextInt();
		}
		
		Arrays.sort(a);
		
		if(N >= K){
			for(int i = 0; i < N - K; i++){
				ans = ans + a[i];
			}
		} else {
			ans = 0;
		}
		
		System.out.println(ans);
	} main {
		// TODO Auto-generated method stub

		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int K = sc.nextInt();
		long ans = 0;
		
		int[] a = new int[N];
		
		for(int i = 0; i < N; i++){
			a[i] = sc.nextInt();
		}
		
		Arrays.sort(a);
		
		if(N >= K){
			for(int i = 0; i < N - K; i++){
				ans = ans + a[i];
			}
		} else {
			ans = 0;
		}
		
		System.out.println(ans);
	} Scanner 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 long ans = 0; ans 0 int[] a = new int[N]; a new int[N] N for(int i = 0; i < N; i++){
			a[i] = sc.nextInt();
		} int i = 0; int i = 0; i 0 i < N i N i++ i++ i {
			a[i] = sc.nextInt();
		} {
			a[i] = sc.nextInt();
		} a[i] = sc.nextInt() a[i] a i sc.nextInt() sc.nextInt sc Arrays.sort(a) Arrays.sort Arrays a if(N >= K){
			for(int i = 0; i < N - K; i++){
				ans = ans + a[i];
			}
		} else {
			ans = 0;
		} N >= K N K {
			for(int i = 0; i < N - K; i++){
				ans = ans + a[i];
			}
		} for(int i = 0; i < N - K; i++){
				ans = ans + a[i];
			} int i = 0; int i = 0; i 0 i < N - K i N - K N K i++ i++ i {
				ans = ans + a[i];
			} {
				ans = ans + a[i];
			} ans = ans + a[i] ans ans + a[i] ans a[i] a i {
			ans = 0;
		} ans = 0 ans 0 System.out.println(ans) System.out.println System.out System System.out ans String[] args args public class Main {

	public static void main(String[] args) {
		// TODO Auto-generated method stub

		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int K = sc.nextInt();
		long ans = 0;
		
		int[] a = new int[N];
		
		for(int i = 0; i < N; i++){
			a[i] = sc.nextInt();
		}
		
		Arrays.sort(a);
		
		if(N >= K){
			for(int i = 0; i < N - K; i++){
				ans = ans + a[i];
			}
		} else {
			ans = 0;
		}
		
		System.out.println(ans);
	}
} public class Main {

	public static void main(String[] args) {
		// TODO Auto-generated method stub

		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int K = sc.nextInt();
		long ans = 0;
		
		int[] a = new int[N];
		
		for(int i = 0; i < N; i++){
			a[i] = sc.nextInt();
		}
		
		Arrays.sort(a);
		
		if(N >= K){
			for(int i = 0; i < N - K; i++){
				ans = ans + a[i];
			}
		} else {
			ans = 0;
		}
		
		System.out.println(ans);
	}
} Main
import java.util.Arrays;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO Auto-generated method stub

		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int K = sc.nextInt();
		long ans = 0;
		
		int[] a = new int[N];
		
		for(int i = 0; i < N; i++){
			a[i] = sc.nextInt();
		}
		
		Arrays.sort(a);
		
		if(N >= K){
			for(int i = 0; i < N - K; i++){
				ans = ans + a[i];
			}
		} else {
			ans = 0;
		}
		
		System.out.println(ans);
	}
}
