import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
        int b = sc.nextInt();
		Long [] in = new Long [a];
        for(int i=0;i<a;i++){in[i] = sc.nextLong();
                            }
        Arrays.sort(in);
		Long c = in[0]-in[0];
        for(int i=0;i<a-b;i++){c+=in[i];}      
		System.out.println(c);
	}
} import java.util.*; util.* java public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
        int b = sc.nextInt();
		Long [] in = new Long [a];
        for(int i=0;i<a;i++){in[i] = sc.nextLong();
                            }
        Arrays.sort(in);
		Long c = in[0]-in[0];
        for(int i=0;i<a-b;i++){c+=in[i];}      
		System.out.println(c);
	}
} Main public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
        int b = sc.nextInt();
		Long [] in = new Long [a];
        for(int i=0;i<a;i++){in[i] = sc.nextLong();
                            }
        Arrays.sort(in);
		Long c = in[0]-in[0];
        for(int i=0;i<a-b;i++){c+=in[i];}      
		System.out.println(c);
	} main {
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
        int b = sc.nextInt();
		Long [] in = new Long [a];
        for(int i=0;i<a;i++){in[i] = sc.nextLong();
                            }
        Arrays.sort(in);
		Long c = in[0]-in[0];
        for(int i=0;i<a-b;i++){c+=in[i];}      
		System.out.println(c);
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int a = sc.nextInt(); a sc.nextInt() sc.nextInt sc int b = sc.nextInt(); b sc.nextInt() sc.nextInt sc Long [] in = new Long [a]; in new Long [a] a for(int i=0;i<a;i++){in[i] = sc.nextLong();
                            } int i=0; int i=0; i 0 i<a i a i++ i++ i {in[i] = sc.nextLong();
                            } {in[i] = sc.nextLong();
                            } in[i] = sc.nextLong() in[i] in i sc.nextLong() sc.nextLong sc Arrays.sort(in) Arrays.sort Arrays in Long c = in[0]-in[0]; c in[0]-in[0] in[0] in 0 in[0] in 0 for(int i=0;i<a-b;i++){c+=in[i];} int i=0; int i=0; i 0 i<a-b i a-b a b i++ i++ i {c+=in[i];} {c+=in[i];} c+=in[i] c in[i] in i System.out.println(c) System.out.println System.out System System.out c String[] args args public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
        int b = sc.nextInt();
		Long [] in = new Long [a];
        for(int i=0;i<a;i++){in[i] = sc.nextLong();
                            }
        Arrays.sort(in);
		Long c = in[0]-in[0];
        for(int i=0;i<a-b;i++){c+=in[i];}      
		System.out.println(c);
	}
} public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
        int b = sc.nextInt();
		Long [] in = new Long [a];
        for(int i=0;i<a;i++){in[i] = sc.nextLong();
                            }
        Arrays.sort(in);
		Long c = in[0]-in[0];
        for(int i=0;i<a-b;i++){c+=in[i];}      
		System.out.println(c);
	}
} Main
import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
        int b = sc.nextInt();
		Long [] in = new Long [a];
        for(int i=0;i<a;i++){in[i] = sc.nextLong();
                            }
        Arrays.sort(in);
		Long c = in[0]-in[0];
        for(int i=0;i<a-b;i++){c+=in[i];}      
		System.out.println(c);
	}
}
