#include <bits/stdc++.h>
using namespace std;
template <typename T>
inline bool smin(T &a, const T &b) {
  return b < a ? a = b, 1 : 0;
}
template <typename T>
inline bool smax(T &a, const T &b) {
  return a < b ? a = b, 1 : 0;
}
const long long N = 50 + 10, maxn = 5e5 + 100;
long long n, d, a[N], ans = 0, cnt = 2e9;
bool dp[maxn];
long long par[maxn];
void prep() {
  vector<long long> vc;
  fill(dp, dp + maxn, 0);
  fill(par, par + maxn, -1);
  for (long long i = 0; i < n; i++) vc.push_back(i);
  dp[0] = 1;
  for (auto x : vc) {
    for (long long i = maxn - 1; i >= a[x]; i--) {
      dp[i] |= dp[i - a[x]];
      if (dp[i - a[x]] && par[i] == -1) par[i] = x;
    }
  }
}
vector<long long> can;
void solve(long long mask, long long dep) {
  long long sx = 0;
  for (long long i = 0; i < n; i++) sx += (bool)(mask >> i & 1) * a[i];
  if (sx == ans)
    smin(cnt, dep);
  else if (sx > ans)
    ans = sx, cnt = dep;
  long long big = 0;
  long long nw = 0;
  long long lo = -1, hi = (long long)can.size();
  while (hi - lo > 1) {
    long long mid = (hi + lo) >> 1;
    if (mid > -1 && mid < (long long)can.size() && can[mid] <= d + sx)
      lo = mid;
    else
      hi = mid;
  }
  big = can[lo];
  if (big <= sx) return;
  while (par[big] != -1) {
    nw |= (1LL << par[big]);
    big -= a[par[big]];
  }
  solve(nw, dep + 1);
}
int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cin >> n >> d;
  for (long long i = 0; i < n; i++) cin >> a[i];
  prep();
  for (long long i = 0; i < maxn; i++)
    if (dp[i]) can.push_back(i);
  solve(0, 0);
  cout << ans << ' ' << cnt << endl;
}
