import java.util.*;
public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int m = sc.nextInt();
        long a[] = new long[n];
        for(int i =0 ; i < n;i++){
            a[i] = sc.nextLong();
        }
        long[] wk = Arrays.stream(a).sorted().toArray();
        long sum = (long)0;
        int x = 0;
        int wksize = wk.length - m;
        //Arrays.stream(wk).forEach(System.out::print);      
        for(long num : wk){
            x++;
            if(x > wksize){
                break;
            }
            sum = sum + num;
          //System.out.println(sum);
        }
        System.out.println(sum);
    }
} import java.util.*; util.* java public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int m = sc.nextInt();
        long a[] = new long[n];
        for(int i =0 ; i < n;i++){
            a[i] = sc.nextLong();
        }
        long[] wk = Arrays.stream(a).sorted().toArray();
        long sum = (long)0;
        int x = 0;
        int wksize = wk.length - m;
        //Arrays.stream(wk).forEach(System.out::print);      
        for(long num : wk){
            x++;
            if(x > wksize){
                break;
            }
            sum = sum + num;
          //System.out.println(sum);
        }
        System.out.println(sum);
    }
} Main public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int m = sc.nextInt();
        long a[] = new long[n];
        for(int i =0 ; i < n;i++){
            a[i] = sc.nextLong();
        }
        long[] wk = Arrays.stream(a).sorted().toArray();
        long sum = (long)0;
        int x = 0;
        int wksize = wk.length - m;
        //Arrays.stream(wk).forEach(System.out::print);      
        for(long num : wk){
            x++;
            if(x > wksize){
                break;
            }
            sum = sum + num;
          //System.out.println(sum);
        }
        System.out.println(sum);
    } main {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int m = sc.nextInt();
        long a[] = new long[n];
        for(int i =0 ; i < n;i++){
            a[i] = sc.nextLong();
        }
        long[] wk = Arrays.stream(a).sorted().toArray();
        long sum = (long)0;
        int x = 0;
        int wksize = wk.length - m;
        //Arrays.stream(wk).forEach(System.out::print);      
        for(long num : wk){
            x++;
            if(x > wksize){
                break;
            }
            sum = sum + num;
          //System.out.println(sum);
        }
        System.out.println(sum);
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int n = sc.nextInt(); n sc.nextInt() sc.nextInt sc int m = sc.nextInt(); m sc.nextInt() sc.nextInt sc long a[] = new long[n]; a new long[n] n for(int i =0 ; i < n;i++){
            a[i] = sc.nextLong();
        } int i =0 ; int i =0 ; i 0 i < n i n i++ i++ i {
            a[i] = sc.nextLong();
        } {
            a[i] = sc.nextLong();
        } a[i] = sc.nextLong() a[i] a i sc.nextLong() sc.nextLong sc long[] wk = Arrays.stream(a).sorted().toArray(); wk Arrays.stream(a).sorted().toArray() Arrays.stream(a).sorted().toArray Arrays.stream(a).sorted() Arrays.stream(a).sorted Arrays.stream(a) Arrays.stream Arrays a long sum = (long)0; sum (long)0 int x = 0; x 0 int wksize = wk.length - m; wksize wk.length - m wk.length wk wk.length m for(long num : wk){
            x++;
            if(x > wksize){
                break;
            }
            sum = sum + num;
          //System.out.println(sum);
        } long num wk {
            x++;
            if(x > wksize){
                break;
            }
            sum = sum + num;
          //System.out.println(sum);
        } {
            x++;
            if(x > wksize){
                break;
            }
            sum = sum + num;
          //System.out.println(sum);
        } x++ x if(x > wksize){
                break;
            } x > wksize x wksize {
                break;
            } break; sum = sum + num sum sum + num sum num 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 sc = new Scanner(System.in);
        int n = sc.nextInt();
        int m = sc.nextInt();
        long a[] = new long[n];
        for(int i =0 ; i < n;i++){
            a[i] = sc.nextLong();
        }
        long[] wk = Arrays.stream(a).sorted().toArray();
        long sum = (long)0;
        int x = 0;
        int wksize = wk.length - m;
        //Arrays.stream(wk).forEach(System.out::print);      
        for(long num : wk){
            x++;
            if(x > wksize){
                break;
            }
            sum = sum + num;
          //System.out.println(sum);
        }
        System.out.println(sum);
    }
} public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int m = sc.nextInt();
        long a[] = new long[n];
        for(int i =0 ; i < n;i++){
            a[i] = sc.nextLong();
        }
        long[] wk = Arrays.stream(a).sorted().toArray();
        long sum = (long)0;
        int x = 0;
        int wksize = wk.length - m;
        //Arrays.stream(wk).forEach(System.out::print);      
        for(long num : wk){
            x++;
            if(x > wksize){
                break;
            }
            sum = sum + num;
          //System.out.println(sum);
        }
        System.out.println(sum);
    }
} Main
import java.util.*;
public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int m = sc.nextInt();
        long a[] = new long[n];
        for(int i =0 ; i < n;i++){
            a[i] = sc.nextLong();
        }
        long[] wk = Arrays.stream(a).sorted().toArray();
        long sum = (long)0;
        int x = 0;
        int wksize = wk.length - m;
        //Arrays.stream(wk).forEach(System.out::print);      
        for(long num : wk){
            x++;
            if(x > wksize){
                break;
            }
            sum = sum + num;
          //System.out.println(sum);
        }
        System.out.println(sum);
    }
}