function myout(text){console.log(text);}//standard output
function Main(input) {
	//input = parseInt(input);
	//input = input.split(" ");
	input = input.split("\n");
	//input = input.split(" ").map((a)=>Number(a));
	//input = input.split("\n").map((a)=>Number(a));
  var K = input[0].split(" ").map((a)=>Number(a))[1];
  var list = input[1].split(" ").map((a)=>Number(a)).sort(function(a,b){
  	return b - a;
  });
  var output = 0;
  for(var i = 0; i < K; i++){
    output += list[i];
  }
  myout(output);
}

Main(require("fs").readFileSync("/dev/stdin", "utf8").trim());
