#include <bits/stdc++.h>
using namespace std;
int a[1010];
int b[1010];
int main() {
  int n, m;
  cin >> n >> m;
  for (int i = 0; i < m; i++) {
    cin >> a[i];
    b[i] = a[i];
  }
  int minn = 0, maxx = 0;
  for (int i = 0; i < n; i++) {
    int tmin = 0;
    while (b[tmin] == 0) tmin++;
    int tmax = 0;
    for (int j = 1; j < m; j++) {
      if (a[j] > a[tmax]) tmax = j;
      if (b[j] > 0 && b[j] < b[tmin]) tmin = j;
    }
    minn += b[tmin]--;
    maxx += a[tmax]--;
  }
  cout << maxx << " " << minn << endl;
  return 0;
}
