#include <bits/stdc++.h>
using namespace std;
const int MAXN = 10000 * 55;
const long long LINF = 1000000000LL * 1000000000LL;
bool f[MAXN], fn[MAXN];
long long ff[MAXN];
int i, j, n, w, d, a[111];
map<long long, int> x;
int main() {
  cin >> n >> d;
  for (i = 0; i < n; i++) {
    cin >> a[i];
    w += a[i];
  }
  f[0] = true;
  for (i = 1; i <= n; i++) {
    int nowW = a[i - 1];
    memset(fn, 0, sizeof(fn));
    for (j = 0; j <= w; j++) {
      fn[j] |= f[j];
      if (j - nowW >= 0) fn[j] |= f[j - nowW];
    }
    memcpy(f, fn, sizeof(f));
  }
  for (i = 0; i <= w; i++) ff[i] = LINF;
  ff[0] = 0;
  int l = 0, r;
  x[ff[0]]++;
  int ans = 0;
  for (i = 1; i <= w; i++) {
    r = i;
    while (r - l > d) {
      x[ff[l]]--;
      if (x[ff[l]] == 0) {
        x.erase(ff[l]);
      }
      l++;
    }
    if (!f[r]) {
      x[ff[r]]++;
      continue;
    }
    long long tmp = x.begin()->first;
    if (tmp < LINF) {
      ans = r;
      ff[r] = tmp + 1;
    }
    x[ff[r]]++;
  }
  cout << ans << ' ' << ff[ans];
  return 0;
}
