#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m;
  cin >> n >> m;
  int a[m], b[m], maxn = 0, minn = 0;
  for (int i = 1; i <= m; i++) {
    cin >> a[i];
    b[i] = a[i];
  }
  for (int j = 1; j <= n; ++j) {
    int index, maxcost = -1, mincost = 9999;
    for (int j = 1; j <= m; ++j) {
      if (a[j] && a[j] > maxcost) {
        maxcost = a[j];
        index = j;
      }
    }
    --a[index];
    maxn += maxcost;
    for (int j = 1; j <= m; ++j) {
      if (b[j] && b[j] < mincost) {
        mincost = b[j];
        index = j;
      }
    }
    --b[index];
    minn += mincost;
  }
  cout << maxn << " " << minn;
  return 0;
}
