#include <bits/stdc++.h>
using namespace std;
priority_queue<int> qmax;
priority_queue<int, vector<int>, greater<int> > qmin;
int n, tmp, m, vmin, vmax;
int main() {
  scanf("%d%d", &n, &m);
  while (m--) {
    scanf("%d", &tmp);
    qmax.push(tmp);
    qmin.push(tmp);
  }
  while (n-- && !qmax.empty()) {
    int v1 = qmax.top();
    int v2 = qmin.top();
    qmax.pop();
    qmin.pop();
    vmax += v1;
    vmin += v2;
    if (v1 > 1) qmax.push(v1 - 1);
    if (v2 > 1) qmin.push(v2 - 1);
  }
  printf("%d %d\n", vmax, vmin);
  return 0;
}
