#include <bits/stdc++.h>
using namespace std;
int p[1100];
int n[1100];
int main() {
  int nn, k;
  cin >> nn >> k;
  int t;
  for (int i = 0; i < k; ++i) {
    cin >> t;
    p[i] = t;
    n[i] = -t;
  }
  int pk = k, nk = k;
  int mxs = 0, mns = 0;
  for (int i = 0; i < nn; ++i) {
    sort(p, p + pk);
    sort(n, n + nk);
    mxs += p[pk - 1];
    mns -= n[nk - 1];
    p[pk - 1]--;
    n[nk - 1]++;
    if (n[nk - 1] == 0) nk--;
    if (p[pk - 1] == 0) pk--;
  }
  cout << mxs << ' ' << mns << endl;
  return 0;
}
