#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  int k;
  cin >> n >> k;
  vector<int> fruit(n);
  for (int i = 0; i < n; i++) {
    cin >> fruit.at(i);
  }
  sort(fruit.begin(), fruit.end());
  int goukei = 0;
  for (int j = 0; j < n; j++) {
    goukei += fruit.at(j);
    if (j == n - 1) {
      cout << goukei << endl;
    }
  }
}
