#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m, a[1000], b[1000], max = 0, min = 0;
  cin >> n >> m;
  for (int i = 0; i < m; ++i) cin >> a[i];
  memcpy(&b, &a, sizeof(a));
  for (int i = 0; i < n; ++i) max += (*max_element(&a[0], &a[m]))--;
  for (int i = 0; i < n; ++i) {
    int *t = min_element(&b[0], &b[m]);
    if (*t == 1) {
      ++min;
      *t = INT_MAX;
    } else
      min += (*t)--;
  }
  cout << max << ' ' << min;
  return 0;
}
