import java.math.BigInteger;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Scanner;
 

//result = Math.pow(num1, num3)
//StringBuffer str = new StringBuffer(hoge1);
//String hoge2 = str.reverse().toString();
//map.containsKey(A)
//Map<String, Integer> map = new HashMap<String, Integer>(n);
//ArrayList<String> cc = new ArrayList<>(n);

public class Main {
	private static Scanner sc = new Scanner(System.in);
	static void p(String ans) {System.out.println(ans);};
	static void p(int ans) {System.out.println(ans);};
	static void p(long ans) {System.out.println(ans);};
	static void p(double ans) {System.out.println(ans);};
	//static String eikomoji[]={"a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z"};
	
	
	public static void main(String[] args) {
	long n=sc.nextInt();
	long k=sc.nextInt();
	long list[]=new long[(int) n];
	for(long i=0;i<n;i++) {
		list[(int) i]=sc.nextInt();
	}
	Arrays.sort(list);
	long ans=0;
	for(long i=0;i<n-k;i++) {
		ans+=list[(int) i];
	}
	p(ans);
 }
} import java.math.BigInteger; BigInteger java.math import java.util.ArrayList; ArrayList java.util import java.util.Arrays; Arrays java.util import java.util.Collection; Collection java.util import java.util.Collections; Collections java.util import java.util.Comparator; Comparator java.util import java.util.HashMap; HashMap java.util import java.util.List; List java.util import java.util.Map; Map java.util import java.util.Map.Entry; Entry java.util.Map import java.util.Scanner; Scanner java.util public class Main {
	private static Scanner sc = new Scanner(System.in);
	static void p(String ans) {System.out.println(ans);};
	static void p(int ans) {System.out.println(ans);};
	static void p(long ans) {System.out.println(ans);};
	static void p(double ans) {System.out.println(ans);};
	//static String eikomoji[]={"a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z"};
	
	
	public static void main(String[] args) {
	long n=sc.nextInt();
	long k=sc.nextInt();
	long list[]=new long[(int) n];
	for(long i=0;i<n;i++) {
		list[(int) i]=sc.nextInt();
	}
	Arrays.sort(list);
	long ans=0;
	for(long i=0;i<n-k;i++) {
		ans+=list[(int) i];
	}
	p(ans);
 }
} Main private static Scanner sc = new Scanner(System.in); sc new Scanner(System.in) static void p(String ans) {System.out.println(ans);} p {System.out.println(ans);} System.out.println(ans) System.out.println System.out System System.out ans String ans ans static void p(int ans) {System.out.println(ans);} p {System.out.println(ans);} System.out.println(ans) System.out.println System.out System System.out ans int ans ans static void p(long ans) {System.out.println(ans);} p {System.out.println(ans);} System.out.println(ans) System.out.println System.out System System.out ans long ans ans static void p(double ans) {System.out.println(ans);} p {System.out.println(ans);} System.out.println(ans) System.out.println System.out System System.out ans double ans ans public static void main(String[] args) {
	long n=sc.nextInt();
	long k=sc.nextInt();
	long list[]=new long[(int) n];
	for(long i=0;i<n;i++) {
		list[(int) i]=sc.nextInt();
	}
	Arrays.sort(list);
	long ans=0;
	for(long i=0;i<n-k;i++) {
		ans+=list[(int) i];
	}
	p(ans);
 } main {
	long n=sc.nextInt();
	long k=sc.nextInt();
	long list[]=new long[(int) n];
	for(long i=0;i<n;i++) {
		list[(int) i]=sc.nextInt();
	}
	Arrays.sort(list);
	long ans=0;
	for(long i=0;i<n-k;i++) {
		ans+=list[(int) i];
	}
	p(ans);
 } long n=sc.nextInt(); n sc.nextInt() sc.nextInt sc long k=sc.nextInt(); k sc.nextInt() sc.nextInt sc long list[]=new long[(int) n]; list new long[(int) n] (int) n for(long i=0;i<n;i++) {
		list[(int) i]=sc.nextInt();
	} long i=0; long i=0; i 0 i<n i n i++ i++ i {
		list[(int) i]=sc.nextInt();
	} {
		list[(int) i]=sc.nextInt();
	} list[(int) i]=sc.nextInt() list[(int) i] list (int) i sc.nextInt() sc.nextInt sc Arrays.sort(list) Arrays.sort Arrays list long ans=0; ans 0 for(long i=0;i<n-k;i++) {
		ans+=list[(int) i];
	} long i=0; long i=0; i 0 i<n-k i n-k n k i++ i++ i {
		ans+=list[(int) i];
	} {
		ans+=list[(int) i];
	} ans+=list[(int) i] ans list[(int) i] list (int) i p(ans) p ans String[] args args public class Main {
	private static Scanner sc = new Scanner(System.in);
	static void p(String ans) {System.out.println(ans);};
	static void p(int ans) {System.out.println(ans);};
	static void p(long ans) {System.out.println(ans);};
	static void p(double ans) {System.out.println(ans);};
	//static String eikomoji[]={"a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z"};
	
	
	public static void main(String[] args) {
	long n=sc.nextInt();
	long k=sc.nextInt();
	long list[]=new long[(int) n];
	for(long i=0;i<n;i++) {
		list[(int) i]=sc.nextInt();
	}
	Arrays.sort(list);
	long ans=0;
	for(long i=0;i<n-k;i++) {
		ans+=list[(int) i];
	}
	p(ans);
 }
} public class Main {
	private static Scanner sc = new Scanner(System.in);
	static void p(String ans) {System.out.println(ans);};
	static void p(int ans) {System.out.println(ans);};
	static void p(long ans) {System.out.println(ans);};
	static void p(double ans) {System.out.println(ans);};
	//static String eikomoji[]={"a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z"};
	
	
	public static void main(String[] args) {
	long n=sc.nextInt();
	long k=sc.nextInt();
	long list[]=new long[(int) n];
	for(long i=0;i<n;i++) {
		list[(int) i]=sc.nextInt();
	}
	Arrays.sort(list);
	long ans=0;
	for(long i=0;i<n-k;i++) {
		ans+=list[(int) i];
	}
	p(ans);
 }
} Main
import java.math.BigInteger;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Scanner;
 

//result = Math.pow(num1, num3)
//StringBuffer str = new StringBuffer(hoge1);
//String hoge2 = str.reverse().toString();
//map.containsKey(A)
//Map<String, Integer> map = new HashMap<String, Integer>(n);
//ArrayList<String> cc = new ArrayList<>(n);

public class Main {
	private static Scanner sc = new Scanner(System.in);
	static void p(String ans) {System.out.println(ans);};
	static void p(int ans) {System.out.println(ans);};
	static void p(long ans) {System.out.println(ans);};
	static void p(double ans) {System.out.println(ans);};
	//static String eikomoji[]={"a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z"};
	
	
	public static void main(String[] args) {
	long n=sc.nextInt();
	long k=sc.nextInt();
	long list[]=new long[(int) n];
	for(long i=0;i<n;i++) {
		list[(int) i]=sc.nextInt();
	}
	Arrays.sort(list);
	long ans=0;
	for(long i=0;i<n-k;i++) {
		ans+=list[(int) i];
	}
	p(ans);
 }
}
