#include <bits/stdc++.h>
using namespace std;
int t1[1001];
int t2[1001];
int main() {
  int n, k;
  scanf("%d %d", &n, &k);
  for (int i = 0; i < k; ++i) {
    scanf("%d", t1 + i);
    t2[i] = t1[i];
  }
  int maxsum = 0;
  for (int i = 0; i < n; ++i) {
    int* it = max_element(t1, t1 + k);
    maxsum += *it;
    *it -= 1;
  }
  int minsum = 0;
  for (int i = 0; i < n; ++i) {
    int* it = min_element(t2, t2 + k);
    minsum += *it;
    *it -= 1;
    if (*it == 0) {
      swap(*it, t2[k - 1]);
      k -= 1;
    }
  }
  printf("%d %d\n", maxsum, minsum);
  return 0;
}
