#include <bits/stdc++.h>
using namespace std;

int main(){
 int n, k; cin >> n >> k;
  vector<int> box;
  for(int i = 0; i < n; ++i){
    cin >> box[i];
  }
  box.sort(box.begin(), v.end());
  int sum = 0;
  for(int i = 0; i < k; ++i){
    sum += vector.at(i);
  }
  cout << sum << endl;
 return 0; 
}
