#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m;
  cin >> n >> m;
  int arr[m], arr2[m];
  for (int i = 0; i < m; i++) {
    cin >> arr[i];
    arr2[i] = arr[i];
  }
  int maxi = 0, mini = 0;
  for (int i = 0; i < n; i++) {
    sort(arr, arr + m);
    sort(arr2, arr2 + m);
    maxi += arr[m - 1];
    arr[m - 1] -= 1;
    mini += arr2[0];
    arr2[0] -= 1;
    if (arr2[0] == 0) arr2[0] = INT_MAX;
  }
  cout << maxi << " " << mini;
  return 0;
}
