import java.io.File;
import java.io.FileNotFoundException;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.Scanner;
import java.util.logging.Level;
import java.util.logging.Logger;

class Main {
    public static void main(String[] args) {
        try {
            Scanner in = new Scanner(new File("A.in"));
            PrintWriter out = new PrintWriter(new File("A.out"));
            int n = 0;
            int k = 0;
            int s = 0;
            n = in.nextInt();
            k = in.nextInt();
            int[] kol = new int[n];
            for (int i = 0; i < kol.length; i++) {
                kol[i] = in.nextInt();
            }
            Arrays.sort(kol);
            for (int i = kol.length - 1; i >= k; i--) {
                s += kol[i];
            }
            out.println(s);
            out.close();
        } catch (FileNotFoundException ex) {
            Logger.getLogger(Main.class.getName()).log(Level.SEVERE, null, ex);
        }        
    }

}
