#include <bits/stdc++.h>
using namespace std;
void A() {
  char c;
  cin >> c;
  if ('a' <= c && c <= 'z') {
    cout << "a" << endl;
  } else {
    cout << "A" << endl;
  }
}
void B() {
  int N, K;
  cin >> N >> K;
  vector<int> vec(N);
  for (int i = 0; i < (int)(N); i++) cin >> vec[i];
  sort((vec).begin(), (vec).end());
  int ans = 0;
  for (int i = 0; i < (int)(N); i++) ans += vec[i];
  cout << ans << endl;
}
inline char itoc(int i) {
  char c;
  if (i == 0) i += 26;
  c = 'a' + (i - 1);
  return c;
}
void C() {
  long long N;
  cin >> N;
  string ans = "";
  while (N) {
    int m = N % 26;
    N /= 26;
    if (m == 0) N--;
    ans += itoc(m);
  }
  reverse(ans.begin(), ans.end());
  cout << ans << endl;
}
int main() { B(); }
