#include <bits/stdc++.h>
using namespace std;
long long func1(long long arr[], long long n, long long m) {
  long long ans = 0;
  priority_queue<long long> pq;
  for (long long i = 1; i <= n; i++) {
    pq.push(arr[i]);
  }
  while (m--) {
    long long value = pq.top();
    pq.pop();
    value--;
    if (value > 0) pq.push(value);
    ans = ans + value + 1;
  }
  return ans;
}
long long func2(long long arr[], long long n, long long m) {
  long long ans = 0;
  priority_queue<long long, vector<long long>, greater<long long> > pq;
  for (long long i = 1; i <= n; i++) {
    pq.push(arr[i]);
  }
  while (m--) {
    long long value = pq.top();
    pq.pop();
    value--;
    if (value > 0) {
      pq.push(value);
    }
    ans = ans + value + 1;
  }
  return ans;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long n, m;
  cin >> m >> n;
  long long arr[n + 1];
  for (long long i = 1; i <= n; i++) {
    cin >> arr[i];
  }
  cout << func1(arr, n, m) << " " << func2(arr, n, m) << endl;
}
