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

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int monsterCount = sc.nextInt();
		int hissatuCount = sc.nextInt();
		long tairyokuList[] = new  long[monsterCount];
		long kougekiCount = 0;
		for(int i= 0; i<monsterCount;  i++) {
			tairyokuList[i] = sc.nextInt();
		}
		Arrays.sort(tairyokuList);
		if(monsterCount< hissatuCount) {
			hissatuCount = monsterCount;
		}
		for(int i=0; i<hissatuCount; i++) {
			tairyokuList[tairyokuList.length-1-i] = 0;
		}
		for(int i= 0; i<monsterCount;  i++) {
			kougekiCount = kougekiCount + tairyokuList[i];
		}
		System.out.println(kougekiCount);
	}
} import java.util.Arrays; Arrays java.util import java.util.Scanner; Scanner java.util public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int monsterCount = sc.nextInt();
		int hissatuCount = sc.nextInt();
		long tairyokuList[] = new  long[monsterCount];
		long kougekiCount = 0;
		for(int i= 0; i<monsterCount;  i++) {
			tairyokuList[i] = sc.nextInt();
		}
		Arrays.sort(tairyokuList);
		if(monsterCount< hissatuCount) {
			hissatuCount = monsterCount;
		}
		for(int i=0; i<hissatuCount; i++) {
			tairyokuList[tairyokuList.length-1-i] = 0;
		}
		for(int i= 0; i<monsterCount;  i++) {
			kougekiCount = kougekiCount + tairyokuList[i];
		}
		System.out.println(kougekiCount);
	}
} Main public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int monsterCount = sc.nextInt();
		int hissatuCount = sc.nextInt();
		long tairyokuList[] = new  long[monsterCount];
		long kougekiCount = 0;
		for(int i= 0; i<monsterCount;  i++) {
			tairyokuList[i] = sc.nextInt();
		}
		Arrays.sort(tairyokuList);
		if(monsterCount< hissatuCount) {
			hissatuCount = monsterCount;
		}
		for(int i=0; i<hissatuCount; i++) {
			tairyokuList[tairyokuList.length-1-i] = 0;
		}
		for(int i= 0; i<monsterCount;  i++) {
			kougekiCount = kougekiCount + tairyokuList[i];
		}
		System.out.println(kougekiCount);
	} main {
		Scanner sc = new Scanner(System.in);
		int monsterCount = sc.nextInt();
		int hissatuCount = sc.nextInt();
		long tairyokuList[] = new  long[monsterCount];
		long kougekiCount = 0;
		for(int i= 0; i<monsterCount;  i++) {
			tairyokuList[i] = sc.nextInt();
		}
		Arrays.sort(tairyokuList);
		if(monsterCount< hissatuCount) {
			hissatuCount = monsterCount;
		}
		for(int i=0; i<hissatuCount; i++) {
			tairyokuList[tairyokuList.length-1-i] = 0;
		}
		for(int i= 0; i<monsterCount;  i++) {
			kougekiCount = kougekiCount + tairyokuList[i];
		}
		System.out.println(kougekiCount);
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int monsterCount = sc.nextInt(); monsterCount sc.nextInt() sc.nextInt sc int hissatuCount = sc.nextInt(); hissatuCount sc.nextInt() sc.nextInt sc long tairyokuList[] = new  long[monsterCount]; tairyokuList new  long[monsterCount] monsterCount long kougekiCount = 0; kougekiCount 0 for(int i= 0; i<monsterCount;  i++) {
			tairyokuList[i] = sc.nextInt();
		} int i= 0; int i= 0; i 0 i<monsterCount i monsterCount i++ i++ i {
			tairyokuList[i] = sc.nextInt();
		} {
			tairyokuList[i] = sc.nextInt();
		} tairyokuList[i] = sc.nextInt() tairyokuList[i] tairyokuList i sc.nextInt() sc.nextInt sc Arrays.sort(tairyokuList) Arrays.sort Arrays tairyokuList if(monsterCount< hissatuCount) {
			hissatuCount = monsterCount;
		} monsterCount< hissatuCount monsterCount hissatuCount {
			hissatuCount = monsterCount;
		} hissatuCount = monsterCount hissatuCount monsterCount for(int i=0; i<hissatuCount; i++) {
			tairyokuList[tairyokuList.length-1-i] = 0;
		} int i=0; int i=0; i 0 i<hissatuCount i hissatuCount i++ i++ i {
			tairyokuList[tairyokuList.length-1-i] = 0;
		} {
			tairyokuList[tairyokuList.length-1-i] = 0;
		} tairyokuList[tairyokuList.length-1-i] = 0 tairyokuList[tairyokuList.length-1-i] tairyokuList tairyokuList.length-1-i tairyokuList.length-1-i tairyokuList.length tairyokuList tairyokuList.length 1 i 0 for(int i= 0; i<monsterCount;  i++) {
			kougekiCount = kougekiCount + tairyokuList[i];
		} int i= 0; int i= 0; i 0 i<monsterCount i monsterCount i++ i++ i {
			kougekiCount = kougekiCount + tairyokuList[i];
		} {
			kougekiCount = kougekiCount + tairyokuList[i];
		} kougekiCount = kougekiCount + tairyokuList[i] kougekiCount kougekiCount + tairyokuList[i] kougekiCount tairyokuList[i] tairyokuList i System.out.println(kougekiCount) System.out.println System.out System System.out kougekiCount String[] args args public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int monsterCount = sc.nextInt();
		int hissatuCount = sc.nextInt();
		long tairyokuList[] = new  long[monsterCount];
		long kougekiCount = 0;
		for(int i= 0; i<monsterCount;  i++) {
			tairyokuList[i] = sc.nextInt();
		}
		Arrays.sort(tairyokuList);
		if(monsterCount< hissatuCount) {
			hissatuCount = monsterCount;
		}
		for(int i=0; i<hissatuCount; i++) {
			tairyokuList[tairyokuList.length-1-i] = 0;
		}
		for(int i= 0; i<monsterCount;  i++) {
			kougekiCount = kougekiCount + tairyokuList[i];
		}
		System.out.println(kougekiCount);
	}
} public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int monsterCount = sc.nextInt();
		int hissatuCount = sc.nextInt();
		long tairyokuList[] = new  long[monsterCount];
		long kougekiCount = 0;
		for(int i= 0; i<monsterCount;  i++) {
			tairyokuList[i] = sc.nextInt();
		}
		Arrays.sort(tairyokuList);
		if(monsterCount< hissatuCount) {
			hissatuCount = monsterCount;
		}
		for(int i=0; i<hissatuCount; i++) {
			tairyokuList[tairyokuList.length-1-i] = 0;
		}
		for(int i= 0; i<monsterCount;  i++) {
			kougekiCount = kougekiCount + tairyokuList[i];
		}
		System.out.println(kougekiCount);
	}
} Main
import java.util.Arrays;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int monsterCount = sc.nextInt();
		int hissatuCount = sc.nextInt();
		long tairyokuList[] = new  long[monsterCount];
		long kougekiCount = 0;
		for(int i= 0; i<monsterCount;  i++) {
			tairyokuList[i] = sc.nextInt();
		}
		Arrays.sort(tairyokuList);
		if(monsterCount< hissatuCount) {
			hissatuCount = monsterCount;
		}
		for(int i=0; i<hissatuCount; i++) {
			tairyokuList[tairyokuList.length-1-i] = 0;
		}
		for(int i= 0; i<monsterCount;  i++) {
			kougekiCount = kougekiCount + tairyokuList[i];
		}
		System.out.println(kougekiCount);
	}
}