#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<int, int>;
int main() {
  int n, k;
  cin >> n >> k;
  vector<int> p(n);
  for (int i = 0; i < (n); ++i) cin >> p[i];
  int ans = 0;
  int MIN;
  for (int i = 0; i < (n); ++i) {
    MIN = p[0];
    for (int j = 1; j < n; ++j) MIN = min(MIN, p[j]);
    if (p[i] == MIN) {
      ans += p[i];
      p.erase(p.begin() + i);
      --n;
    }
  }
  cout << ans << endl;
  return 0;
}
