import java.util.ArrayList;
import java.util.Collections;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);

		int n = scan.nextInt();
		int k = scan.nextInt();
		long sum = 0;
		ArrayList<Long> list = new ArrayList<Long>(n);

		for(int i = 0;i < n;i++) {
			list.add(scan.nextLong());
		}

		Collections.sort(list , Collections.reverseOrder());

		if(k >= n) {
			System.out.println(0);
		}else {
			for(int i = 0;i < n;i++) {
				if(k == 0) {
					sum += list.get(i);
				}else {
					k -= 1;
				}
			}

			System.out.println(sum);
		}
	}
} import java.util.ArrayList; ArrayList java.util import java.util.Collections; Collections java.util import java.util.Scanner; Scanner java.util public class Main {
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);

		int n = scan.nextInt();
		int k = scan.nextInt();
		long sum = 0;
		ArrayList<Long> list = new ArrayList<Long>(n);

		for(int i = 0;i < n;i++) {
			list.add(scan.nextLong());
		}

		Collections.sort(list , Collections.reverseOrder());

		if(k >= n) {
			System.out.println(0);
		}else {
			for(int i = 0;i < n;i++) {
				if(k == 0) {
					sum += list.get(i);
				}else {
					k -= 1;
				}
			}

			System.out.println(sum);
		}
	}
} Main public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);

		int n = scan.nextInt();
		int k = scan.nextInt();
		long sum = 0;
		ArrayList<Long> list = new ArrayList<Long>(n);

		for(int i = 0;i < n;i++) {
			list.add(scan.nextLong());
		}

		Collections.sort(list , Collections.reverseOrder());

		if(k >= n) {
			System.out.println(0);
		}else {
			for(int i = 0;i < n;i++) {
				if(k == 0) {
					sum += list.get(i);
				}else {
					k -= 1;
				}
			}

			System.out.println(sum);
		}
	} main {
		Scanner scan = new Scanner(System.in);

		int n = scan.nextInt();
		int k = scan.nextInt();
		long sum = 0;
		ArrayList<Long> list = new ArrayList<Long>(n);

		for(int i = 0;i < n;i++) {
			list.add(scan.nextLong());
		}

		Collections.sort(list , Collections.reverseOrder());

		if(k >= n) {
			System.out.println(0);
		}else {
			for(int i = 0;i < n;i++) {
				if(k == 0) {
					sum += list.get(i);
				}else {
					k -= 1;
				}
			}

			System.out.println(sum);
		}
	} Scanner scan = new Scanner(System.in); scan new Scanner(System.in) int n = scan.nextInt(); n scan.nextInt() scan.nextInt scan int k = scan.nextInt(); k scan.nextInt() scan.nextInt scan long sum = 0; sum 0 ArrayList<Long> list = new ArrayList<Long>(n); list new ArrayList<Long>(n) for(int i = 0;i < n;i++) {
			list.add(scan.nextLong());
		} int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
			list.add(scan.nextLong());
		} {
			list.add(scan.nextLong());
		} list.add(scan.nextLong()) list.add list scan.nextLong() scan.nextLong scan Collections.sort(list , Collections.reverseOrder()) Collections.sort Collections list Collections.reverseOrder() Collections.reverseOrder Collections if(k >= n) {
			System.out.println(0);
		}else {
			for(int i = 0;i < n;i++) {
				if(k == 0) {
					sum += list.get(i);
				}else {
					k -= 1;
				}
			}

			System.out.println(sum);
		} k >= n k n {
			System.out.println(0);
		} System.out.println(0) System.out.println System.out System System.out 0 {
			for(int i = 0;i < n;i++) {
				if(k == 0) {
					sum += list.get(i);
				}else {
					k -= 1;
				}
			}

			System.out.println(sum);
		} for(int i = 0;i < n;i++) {
				if(k == 0) {
					sum += list.get(i);
				}else {
					k -= 1;
				}
			} int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
				if(k == 0) {
					sum += list.get(i);
				}else {
					k -= 1;
				}
			} {
				if(k == 0) {
					sum += list.get(i);
				}else {
					k -= 1;
				}
			} if(k == 0) {
					sum += list.get(i);
				}else {
					k -= 1;
				} k == 0 k 0 {
					sum += list.get(i);
				} sum += list.get(i) sum list.get(i) list.get list i {
					k -= 1;
				} k -= 1 k 1 System.out.println(sum) System.out.println System.out System System.out sum String[] args args public class Main {
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);

		int n = scan.nextInt();
		int k = scan.nextInt();
		long sum = 0;
		ArrayList<Long> list = new ArrayList<Long>(n);

		for(int i = 0;i < n;i++) {
			list.add(scan.nextLong());
		}

		Collections.sort(list , Collections.reverseOrder());

		if(k >= n) {
			System.out.println(0);
		}else {
			for(int i = 0;i < n;i++) {
				if(k == 0) {
					sum += list.get(i);
				}else {
					k -= 1;
				}
			}

			System.out.println(sum);
		}
	}
} public class Main {
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);

		int n = scan.nextInt();
		int k = scan.nextInt();
		long sum = 0;
		ArrayList<Long> list = new ArrayList<Long>(n);

		for(int i = 0;i < n;i++) {
			list.add(scan.nextLong());
		}

		Collections.sort(list , Collections.reverseOrder());

		if(k >= n) {
			System.out.println(0);
		}else {
			for(int i = 0;i < n;i++) {
				if(k == 0) {
					sum += list.get(i);
				}else {
					k -= 1;
				}
			}

			System.out.println(sum);
		}
	}
} Main
import java.util.ArrayList;
import java.util.Collections;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);

		int n = scan.nextInt();
		int k = scan.nextInt();
		long sum = 0;
		ArrayList<Long> list = new ArrayList<Long>(n);

		for(int i = 0;i < n;i++) {
			list.add(scan.nextLong());
		}

		Collections.sort(list , Collections.reverseOrder());

		if(k >= n) {
			System.out.println(0);
		}else {
			for(int i = 0;i < n;i++) {
				if(k == 0) {
					sum += list.get(i);
				}else {
					k -= 1;
				}
			}

			System.out.println(sum);
		}
	}
}
