#include <iostream>
#include <vector>
#include <algorithm>
#include <utility>
using namespace std;
using ll = long long;

ll max_val(vector<ll>& t, ll W) {
  int hd = 0, tl = t.size() - 1;
  ll max_val = 0;
  ll prev = W;
  while (hd <= tl) {
    max_val += max(abs(t[hd] - prev), abs(t[hd] - W));
    prev = t[hd];
    if (hd != tl) {
      max_val += max(abs(t[tl] - prev), abs(t[tl] - W));
      prev = t[tl];
    }
    hd++, tl--;
  }
  return max_val;
}

ll min_val(vector<ll> t, ll W) {
  if ((*t.begin() - W) * (*t.rbegin() - W) >= 0) {
    return max(abs(*t.begin() - W), abs(*t.rbegin() - W));
  }
  return abs(*t.begin() - W) + abs(*t.rbegin() - W);
}

int main() {
  ll N, W; cin >> N >> W;
  vector<ll> t(N);
  for (int i = 0; i < N; ++i)
    cin >> t[i];
  sort(t.begin(), t.end());
  ll asc = max_val(t, W);
  sort(t.begin(), t.end(), greater<ll>());
  ll dec = max_val(t, W);
  cout << min_val(t, W) << ' ' << max(asc, dec) << endl;
  return 0;
}