// parameter "input" gets all data
function Main(input) {
	// the first line is assigned to input[0], the second line is assigned to input[1] similarly.
	input = input.split("\n");
	let n = input[0].split(" ")[0];
	let k = input[0].split(" ")[1];
	let arr = input[1].split(" ").map(el => parseInt(el));
	arr.sort();
  	let ans = 0;
	for(let i=0;i<arr.length;i++)
		ans+=arr[i];
  	
  	console.log(ans);
}
// Don't edit this line!
Main(require("fs").readFileSync("/dev/stdin", "utf8"));