import java.util.*;
class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
		int n = sc.nextInt();
		Long[] mns = new Long[n];
		int k = sc.nextInt();
		Long ans = 0l;

		for(int i=0;i<n;i++){
			mns[i] = sc.nextLong();
		}

		Arrays.sort(mns);

		for(int m=0;m<n-k;m++){
			ans += mns[m];
		}

		System.out.println(ans);

		}
	} import java.util.*; util.* java class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
		int n = sc.nextInt();
		Long[] mns = new Long[n];
		int k = sc.nextInt();
		Long ans = 0l;

		for(int i=0;i<n;i++){
			mns[i] = sc.nextLong();
		}

		Arrays.sort(mns);

		for(int m=0;m<n-k;m++){
			ans += mns[m];
		}

		System.out.println(ans);

		}
	} Main public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
		int n = sc.nextInt();
		Long[] mns = new Long[n];
		int k = sc.nextInt();
		Long ans = 0l;

		for(int i=0;i<n;i++){
			mns[i] = sc.nextLong();
		}

		Arrays.sort(mns);

		for(int m=0;m<n-k;m++){
			ans += mns[m];
		}

		System.out.println(ans);

		} main {
		Scanner sc = new Scanner(System.in);
		
		int n = sc.nextInt();
		Long[] mns = new Long[n];
		int k = sc.nextInt();
		Long ans = 0l;

		for(int i=0;i<n;i++){
			mns[i] = sc.nextLong();
		}

		Arrays.sort(mns);

		for(int m=0;m<n-k;m++){
			ans += mns[m];
		}

		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 Long[] mns = new Long[n]; mns new Long[n] n int k = sc.nextInt(); k sc.nextInt() sc.nextInt sc Long ans = 0l; ans 0l for(int i=0;i<n;i++){
			mns[i] = sc.nextLong();
		} int i=0; int i=0; i 0 i<n i n i++ i++ i {
			mns[i] = sc.nextLong();
		} {
			mns[i] = sc.nextLong();
		} mns[i] = sc.nextLong() mns[i] mns i sc.nextLong() sc.nextLong sc Arrays.sort(mns) Arrays.sort Arrays mns for(int m=0;m<n-k;m++){
			ans += mns[m];
		} int m=0; int m=0; m 0 m<n-k m n-k n k m++ m++ m {
			ans += mns[m];
		} {
			ans += mns[m];
		} ans += mns[m] ans mns[m] mns m System.out.println(ans) System.out.println System.out System System.out ans String[] args args
import java.util.*;
class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
		int n = sc.nextInt();
		Long[] mns = new Long[n];
		int k = sc.nextInt();
		Long ans = 0l;

		for(int i=0;i<n;i++){
			mns[i] = sc.nextLong();
		}

		Arrays.sort(mns);

		for(int m=0;m<n-k;m++){
			ans += mns[m];
		}

		System.out.println(ans);

		}
	}