import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.Arrays;

public class Main {

	static BufferedReader reader;
	//static field here
	
	public static void main(String[] args) {
		// TODO Auto-generated method stub
		reader = new BufferedReader(new InputStreamReader(System.in));
		//code here
		String[] HN = readLine();
		int N = Integer.parseInt(HN[0]);
		int K = Integer.parseInt(HN[1]);
		String[] as = readLine();
		int[] a = new int[N];
		for(int i=0;i<N;i++) {
			a[i]=Integer.parseInt(as[i]);
		}
		Arrays.sort(a);
		long cnt = 0;
		for(int i=0;i<N-K;i++) {
			cnt+=a[i];
		}
		print(cnt);
		
		
		//String[] s = readLine();
		//print(num);
	}
	
	//functions here
	//note that all methods should be STATIC
	private static long gcd(long m, long n) {
	    if(m < n) return gcd(n, m);
	    if(n == 0) return m;
	    return gcd(n, m % n);
	}
	private static long lcm(long m, long n) {
	    return m * n / gcd(m, n);
	}
	private static String[] readLine(){
		try{
			return reader.readLine().split(" ");
		}catch(Exception e){
			e.printStackTrace();
			return new String[]{e.getMessage()};
		}
	}
	private static void print(Object o){
		System.out.println(o);
	}
	private static void print(){
		System.out.println();
	}
} import java.io.BufferedReader; BufferedReader java.io import java.io.InputStreamReader; InputStreamReader java.io import java.util.Arrays; Arrays java.util public class Main {

	static BufferedReader reader;
	//static field here
	
	public static void main(String[] args) {
		// TODO Auto-generated method stub
		reader = new BufferedReader(new InputStreamReader(System.in));
		//code here
		String[] HN = readLine();
		int N = Integer.parseInt(HN[0]);
		int K = Integer.parseInt(HN[1]);
		String[] as = readLine();
		int[] a = new int[N];
		for(int i=0;i<N;i++) {
			a[i]=Integer.parseInt(as[i]);
		}
		Arrays.sort(a);
		long cnt = 0;
		for(int i=0;i<N-K;i++) {
			cnt+=a[i];
		}
		print(cnt);
		
		
		//String[] s = readLine();
		//print(num);
	}
	
	//functions here
	//note that all methods should be STATIC
	private static long gcd(long m, long n) {
	    if(m < n) return gcd(n, m);
	    if(n == 0) return m;
	    return gcd(n, m % n);
	}
	private static long lcm(long m, long n) {
	    return m * n / gcd(m, n);
	}
	private static String[] readLine(){
		try{
			return reader.readLine().split(" ");
		}catch(Exception e){
			e.printStackTrace();
			return new String[]{e.getMessage()};
		}
	}
	private static void print(Object o){
		System.out.println(o);
	}
	private static void print(){
		System.out.println();
	}
} Main static BufferedReader reader; reader public static void main(String[] args) {
		// TODO Auto-generated method stub
		reader = new BufferedReader(new InputStreamReader(System.in));
		//code here
		String[] HN = readLine();
		int N = Integer.parseInt(HN[0]);
		int K = Integer.parseInt(HN[1]);
		String[] as = readLine();
		int[] a = new int[N];
		for(int i=0;i<N;i++) {
			a[i]=Integer.parseInt(as[i]);
		}
		Arrays.sort(a);
		long cnt = 0;
		for(int i=0;i<N-K;i++) {
			cnt+=a[i];
		}
		print(cnt);
		
		
		//String[] s = readLine();
		//print(num);
	} main {
		// TODO Auto-generated method stub
		reader = new BufferedReader(new InputStreamReader(System.in));
		//code here
		String[] HN = readLine();
		int N = Integer.parseInt(HN[0]);
		int K = Integer.parseInt(HN[1]);
		String[] as = readLine();
		int[] a = new int[N];
		for(int i=0;i<N;i++) {
			a[i]=Integer.parseInt(as[i]);
		}
		Arrays.sort(a);
		long cnt = 0;
		for(int i=0;i<N-K;i++) {
			cnt+=a[i];
		}
		print(cnt);
		
		
		//String[] s = readLine();
		//print(num);
	} reader = new BufferedReader(new InputStreamReader(System.in)) reader new BufferedReader(new InputStreamReader(System.in)) String[] HN = readLine(); HN readLine() readLine int N = Integer.parseInt(HN[0]); N Integer.parseInt(HN[0]) Integer.parseInt Integer HN[0] HN 0 int K = Integer.parseInt(HN[1]); K Integer.parseInt(HN[1]) Integer.parseInt Integer HN[1] HN 1 String[] as = readLine(); as readLine() readLine int[] a = new int[N]; a new int[N] N for(int i=0;i<N;i++) {
			a[i]=Integer.parseInt(as[i]);
		} int i=0; int i=0; i 0 i<N i N i++ i++ i {
			a[i]=Integer.parseInt(as[i]);
		} {
			a[i]=Integer.parseInt(as[i]);
		} a[i]=Integer.parseInt(as[i]) a[i] a i Integer.parseInt(as[i]) Integer.parseInt Integer as[i] as i Arrays.sort(a) Arrays.sort Arrays a long cnt = 0; cnt 0 for(int i=0;i<N-K;i++) {
			cnt+=a[i];
		} int i=0; int i=0; i 0 i<N-K i N-K N K i++ i++ i {
			cnt+=a[i];
		} {
			cnt+=a[i];
		} cnt+=a[i] cnt a[i] a i print(cnt) print cnt String[] args args //functions here
	//note that all methods should be STATIC
	private static long gcd(long m, long n) {
	    if(m < n) return gcd(n, m);
	    if(n == 0) return m;
	    return gcd(n, m % n);
	} gcd {
	    if(m < n) return gcd(n, m);
	    if(n == 0) return m;
	    return gcd(n, m % n);
	} if(m < n) return gcd(n, m); m < n m n return gcd(n, m); gcd(n, m) gcd n m if(n == 0) return m; n == 0 n 0 return m; m return gcd(n, m % n); gcd(n, m % n) gcd n m % n m n long m m long n n private static long lcm(long m, long n) {
	    return m * n / gcd(m, n);
	} lcm {
	    return m * n / gcd(m, n);
	} return m * n / gcd(m, n); m * n / gcd(m, n) m * n m n gcd(m, n) gcd m n long m m long n n private static String[] readLine(){
		try{
			return reader.readLine().split(" ");
		}catch(Exception e){
			e.printStackTrace();
			return new String[]{e.getMessage()};
		}
	} readLine {
		try{
			return reader.readLine().split(" ");
		}catch(Exception e){
			e.printStackTrace();
			return new String[]{e.getMessage()};
		}
	} try{
			return reader.readLine().split(" ");
		}catch(Exception e){
			e.printStackTrace();
			return new String[]{e.getMessage()};
		} catch(Exception e){
			e.printStackTrace();
			return new String[]{e.getMessage()};
		} Exception e {
			e.printStackTrace();
			return new String[]{e.getMessage()};
		} e.printStackTrace() e.printStackTrace e return new String[]{e.getMessage()}; new String[]{e.getMessage()} {
			return reader.readLine().split(" ");
		} return reader.readLine().split(" "); reader.readLine().split(" ") reader.readLine().split reader.readLine() reader.readLine reader " " private static void print(Object o){
		System.out.println(o);
	} print {
		System.out.println(o);
	} System.out.println(o) System.out.println System.out System System.out o Object o o private static void print(){
		System.out.println();
	} print {
		System.out.println();
	} System.out.println() System.out.println System.out System System.out public class Main {

	static BufferedReader reader;
	//static field here
	
	public static void main(String[] args) {
		// TODO Auto-generated method stub
		reader = new BufferedReader(new InputStreamReader(System.in));
		//code here
		String[] HN = readLine();
		int N = Integer.parseInt(HN[0]);
		int K = Integer.parseInt(HN[1]);
		String[] as = readLine();
		int[] a = new int[N];
		for(int i=0;i<N;i++) {
			a[i]=Integer.parseInt(as[i]);
		}
		Arrays.sort(a);
		long cnt = 0;
		for(int i=0;i<N-K;i++) {
			cnt+=a[i];
		}
		print(cnt);
		
		
		//String[] s = readLine();
		//print(num);
	}
	
	//functions here
	//note that all methods should be STATIC
	private static long gcd(long m, long n) {
	    if(m < n) return gcd(n, m);
	    if(n == 0) return m;
	    return gcd(n, m % n);
	}
	private static long lcm(long m, long n) {
	    return m * n / gcd(m, n);
	}
	private static String[] readLine(){
		try{
			return reader.readLine().split(" ");
		}catch(Exception e){
			e.printStackTrace();
			return new String[]{e.getMessage()};
		}
	}
	private static void print(Object o){
		System.out.println(o);
	}
	private static void print(){
		System.out.println();
	}
} public class Main {

	static BufferedReader reader;
	//static field here
	
	public static void main(String[] args) {
		// TODO Auto-generated method stub
		reader = new BufferedReader(new InputStreamReader(System.in));
		//code here
		String[] HN = readLine();
		int N = Integer.parseInt(HN[0]);
		int K = Integer.parseInt(HN[1]);
		String[] as = readLine();
		int[] a = new int[N];
		for(int i=0;i<N;i++) {
			a[i]=Integer.parseInt(as[i]);
		}
		Arrays.sort(a);
		long cnt = 0;
		for(int i=0;i<N-K;i++) {
			cnt+=a[i];
		}
		print(cnt);
		
		
		//String[] s = readLine();
		//print(num);
	}
	
	//functions here
	//note that all methods should be STATIC
	private static long gcd(long m, long n) {
	    if(m < n) return gcd(n, m);
	    if(n == 0) return m;
	    return gcd(n, m % n);
	}
	private static long lcm(long m, long n) {
	    return m * n / gcd(m, n);
	}
	private static String[] readLine(){
		try{
			return reader.readLine().split(" ");
		}catch(Exception e){
			e.printStackTrace();
			return new String[]{e.getMessage()};
		}
	}
	private static void print(Object o){
		System.out.println(o);
	}
	private static void print(){
		System.out.println();
	}
} Main
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.Arrays;

public class Main {

	static BufferedReader reader;
	//static field here
	
	public static void main(String[] args) {
		// TODO Auto-generated method stub
		reader = new BufferedReader(new InputStreamReader(System.in));
		//code here
		String[] HN = readLine();
		int N = Integer.parseInt(HN[0]);
		int K = Integer.parseInt(HN[1]);
		String[] as = readLine();
		int[] a = new int[N];
		for(int i=0;i<N;i++) {
			a[i]=Integer.parseInt(as[i]);
		}
		Arrays.sort(a);
		long cnt = 0;
		for(int i=0;i<N-K;i++) {
			cnt+=a[i];
		}
		print(cnt);
		
		
		//String[] s = readLine();
		//print(num);
	}
	
	//functions here
	//note that all methods should be STATIC
	private static long gcd(long m, long n) {
	    if(m < n) return gcd(n, m);
	    if(n == 0) return m;
	    return gcd(n, m % n);
	}
	private static long lcm(long m, long n) {
	    return m * n / gcd(m, n);
	}
	private static String[] readLine(){
		try{
			return reader.readLine().split(" ");
		}catch(Exception e){
			e.printStackTrace();
			return new String[]{e.getMessage()};
		}
	}
	private static void print(Object o){
		System.out.println(o);
	}
	private static void print(){
		System.out.println();
	}
}