#include <bits/stdc++.h>
using namespace std;
int sum[501000];
int main() {
  int maxs = 0, i, j, n, k, d, s, cnt = 0, sr;
  cin >> n >> d;
  sum[0] = 1;
  for (i = 1; i <= n; i++) {
    cin >> k;
    maxs += k;
    for (j = maxs - k; j >= 0; j--)
      if (sum[j]) sum[j + k] = 1;
  }
  sr = s = 0;
  for (i = 1; i <= maxs; i++) {
    if (sum[i]) {
      if (i - sr <= d) {
        s = i - sr;
      } else {
        if (s) {
          sr = sr + s;
          cnt++;
        }
        if (i - sr <= d) {
          s = i - sr;
        } else {
          s = 0;
          break;
        }
      }
    }
  }
  if (s <= d && s) {
    sr += s;
    cnt++;
  }
  cout << sr << " " << cnt << endl;
  return 0;
}
