#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, k;
  vector<int> input;
  for (int i = 0; i < n; i++) {
    int num;
    cin >> num;
    input.push_back(num);
  }
  sort(input.begin(), input.end());
  int total = 0;
  for (int i = 0; i < k; i++) {
    total += input[i];
  }
  cout << total << endl;
}
