#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 5;
int n, k, a[N];
int main() {
  scanf("%d%d", &n, &k);
  for (int i = 1; i <= n; i++) scanf("%d", &a[i]);
  long long ans = 0;
  sort(a + 1, a + 1 + n);
  for (int i = 1; i <= n; i++) ans += a[i];
  printf("%lld\n", ans);
}
