#include <bits/stdc++.h>
using namespace std;
inline void setmin(int &x, int y) {
  if (y < x) x = y;
}
inline void setmax(int &x, int y) {
  if (y > x) x = y;
}
inline void setmin(long long &x, long long y) {
  if (y < x) x = y;
}
inline void setmax(long long &x, long long y) {
  if (y > x) x = y;
}
const int N = 100000;
const int inf = (int)1e9 + 1;
const long long big = (long long)1e18 + 1;
const int P = 239;
const int MOD = (int)1e9 + 7;
const int MOD1 = (int)1e9 + 9;
const double eps = 1e-9;
const double pi = atan2(0, -1);
const int ABC = 26;
bitset<50 * 10000 + 1> dp;
int ans[50 * 10000 + 1];
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.precision(20);
  cout << fixed;
  int n, d;
  cin >> n >> d;
  int a[n];
  for (int i = 0; i < n; i++) cin >> a[i];
  sort(a, a + n);
  int pos = 0, sum = 0;
  while (pos < n && sum + d >= a[pos]) sum += a[pos++];
  n = pos;
  dp.set(0);
  for (int i = 0; i < n; i++) dp |= (dp << a[i]);
  fill(ans, ans + 50 * 10000 + 1, inf);
  ans[0] = 0;
  multiset<int> vals;
  vals.insert(0);
  pos = 0;
  for (int i = 1; i < 50 * 10000 + 1; i++) {
    while (pos + d < i) vals.erase(vals.find(ans[pos++]));
    if (dp.test(i)) setmin(ans[i], (*vals.begin()) + 1);
    vals.insert(ans[i]);
  }
  for (int i = 50 * 10000; i > -1; i--)
    if (ans[i] != inf) {
      cout << i << " " << ans[i] << "\n";
      break;
    }
  return 0;
}
