#include <bits/stdc++.h>
using namespace std;
int cmp(int a, int b) { return a > b; }
int main() {
  int n, m, seat[1005], max = 0, min = 0, seat2[1005];
  cin >> n >> m;
  for (int i = 0; i < m; i++) {
    cin >> seat[i];
    seat2[i] = seat[i];
  }
  sort(seat, seat + m, cmp);
  for (int i = 1; i <= n; i++) {
    max += seat[0];
    seat[0]--;
    int j;
    for (j = 1;; j++)
      if (seat[j] <= seat[0]) break;
    sort(seat, seat + j, cmp);
  }
  sort(seat2, seat2 + m);
  for (int i = 1; i <= n; i++) {
    int k;
    for (k = 0; k < n; k++)
      if (seat2[k]) break;
    min += seat2[k];
    seat2[k]--;
  }
  cout << max << " " << min << endl;
}
