#include <bits/stdc++.h>
using namespace std;
const int MAXV = 500010;
bool g[MAXV];
int c[60], f[MAXV];
int q[MAXV];
int main() {
  int n, d, m;
  while (cin >> n >> d) {
    m = 0;
    for (int i = 0; i < (n); i++) cin >> c[i], m += c[i];
    memset(g, 0, sizeof(g));
    g[0] = true;
    for (int i = 0; i < (n); i++) {
      for (int j = m; j >= c[i]; --j) {
        if (g[j - c[i]]) g[j] = true;
      }
    }
    memset(f, 0x7f, sizeof(f));
    f[0] = 0;
    int h = 0, t = 0;
    q[0] = 0;
    for (int i = 1; i <= m; ++i) {
      if (!g[i]) continue;
      while (h <= t && i - q[h] > d) ++h;
      if (h > t) break;
      f[i] = f[q[h]] + 1;
      while (h <= t && f[i] <= f[q[t]]) --t;
      q[++t] = i;
    }
    int ans = 0;
    for (int i = 1; i <= m; ++i)
      if (f[i] < 0x7f7f7f7f) ans = i;
    cout << ans << " " << f[ans] << endl;
  }
  return 0;
}
