import java.util.Scanner;
public class Main{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int k = sc.nextInt();
		int[] price = new int[n];
		for(int i = 0; i < n; i++){
			price[i] = sc.nextInt();
		}
		for(int i = 0; i < n; i++){
			for(int j = i; j < n; j++){
				if(price[i] > price[j]){
					int tmp = price[i];
					price[i] = price[j];
					price[j] = tmp;
				}
			}
		}
		int res = 0;
		for(int i = 0; i < k; i++){
			res += price[i];
		}
		System.out.println(res);
	}

} import java.util.Scanner; Scanner java.util public class Main{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int k = sc.nextInt();
		int[] price = new int[n];
		for(int i = 0; i < n; i++){
			price[i] = sc.nextInt();
		}
		for(int i = 0; i < n; i++){
			for(int j = i; j < n; j++){
				if(price[i] > price[j]){
					int tmp = price[i];
					price[i] = price[j];
					price[j] = tmp;
				}
			}
		}
		int res = 0;
		for(int i = 0; i < k; i++){
			res += price[i];
		}
		System.out.println(res);
	}

} Main public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int k = sc.nextInt();
		int[] price = new int[n];
		for(int i = 0; i < n; i++){
			price[i] = sc.nextInt();
		}
		for(int i = 0; i < n; i++){
			for(int j = i; j < n; j++){
				if(price[i] > price[j]){
					int tmp = price[i];
					price[i] = price[j];
					price[j] = tmp;
				}
			}
		}
		int res = 0;
		for(int i = 0; i < k; i++){
			res += price[i];
		}
		System.out.println(res);
	} main {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int k = sc.nextInt();
		int[] price = new int[n];
		for(int i = 0; i < n; i++){
			price[i] = sc.nextInt();
		}
		for(int i = 0; i < n; i++){
			for(int j = i; j < n; j++){
				if(price[i] > price[j]){
					int tmp = price[i];
					price[i] = price[j];
					price[j] = tmp;
				}
			}
		}
		int res = 0;
		for(int i = 0; i < k; i++){
			res += price[i];
		}
		System.out.println(res);
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int n = sc.nextInt(); n sc.nextInt() sc.nextInt sc int k = sc.nextInt(); k sc.nextInt() sc.nextInt sc int[] price = new int[n]; price new int[n] n for(int i = 0; i < n; i++){
			price[i] = sc.nextInt();
		} int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
			price[i] = sc.nextInt();
		} {
			price[i] = sc.nextInt();
		} price[i] = sc.nextInt() price[i] price i sc.nextInt() sc.nextInt sc for(int i = 0; i < n; i++){
			for(int j = i; j < n; j++){
				if(price[i] > price[j]){
					int tmp = price[i];
					price[i] = price[j];
					price[j] = tmp;
				}
			}
		} int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
			for(int j = i; j < n; j++){
				if(price[i] > price[j]){
					int tmp = price[i];
					price[i] = price[j];
					price[j] = tmp;
				}
			}
		} {
			for(int j = i; j < n; j++){
				if(price[i] > price[j]){
					int tmp = price[i];
					price[i] = price[j];
					price[j] = tmp;
				}
			}
		} for(int j = i; j < n; j++){
				if(price[i] > price[j]){
					int tmp = price[i];
					price[i] = price[j];
					price[j] = tmp;
				}
			} int j = i; int j = i; j i j < n j n j++ j++ j {
				if(price[i] > price[j]){
					int tmp = price[i];
					price[i] = price[j];
					price[j] = tmp;
				}
			} {
				if(price[i] > price[j]){
					int tmp = price[i];
					price[i] = price[j];
					price[j] = tmp;
				}
			} if(price[i] > price[j]){
					int tmp = price[i];
					price[i] = price[j];
					price[j] = tmp;
				} price[i] > price[j] price[i] price i price[j] price j {
					int tmp = price[i];
					price[i] = price[j];
					price[j] = tmp;
				} int tmp = price[i]; tmp price[i] price i price[i] = price[j] price[i] price i price[j] price j price[j] = tmp price[j] price j tmp int res = 0; res 0 for(int i = 0; i < k; i++){
			res += price[i];
		} int i = 0; int i = 0; i 0 i < k i k i++ i++ i {
			res += price[i];
		} {
			res += price[i];
		} res += price[i] res price[i] price i System.out.println(res) System.out.println System.out System System.out res String[] args args public class Main{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int k = sc.nextInt();
		int[] price = new int[n];
		for(int i = 0; i < n; i++){
			price[i] = sc.nextInt();
		}
		for(int i = 0; i < n; i++){
			for(int j = i; j < n; j++){
				if(price[i] > price[j]){
					int tmp = price[i];
					price[i] = price[j];
					price[j] = tmp;
				}
			}
		}
		int res = 0;
		for(int i = 0; i < k; i++){
			res += price[i];
		}
		System.out.println(res);
	}

} public class Main{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int k = sc.nextInt();
		int[] price = new int[n];
		for(int i = 0; i < n; i++){
			price[i] = sc.nextInt();
		}
		for(int i = 0; i < n; i++){
			for(int j = i; j < n; j++){
				if(price[i] > price[j]){
					int tmp = price[i];
					price[i] = price[j];
					price[j] = tmp;
				}
			}
		}
		int res = 0;
		for(int i = 0; i < k; i++){
			res += price[i];
		}
		System.out.println(res);
	}

} Main
import java.util.Scanner;
public class Main{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int k = sc.nextInt();
		int[] price = new int[n];
		for(int i = 0; i < n; i++){
			price[i] = sc.nextInt();
		}
		for(int i = 0; i < n; i++){
			for(int j = i; j < n; j++){
				if(price[i] > price[j]){
					int tmp = price[i];
					price[i] = price[j];
					price[j] = tmp;
				}
			}
		}
		int res = 0;
		for(int i = 0; i < k; i++){
			res += price[i];
		}
		System.out.println(res);
	}

}