#include <bits/stdc++.h>
using namespace std;
const int mx = 50 + 5;
const int mxv = 10000 + 5;
const int mxs = mxv * mx;
int data[mx];
bool possible[mxs];
int possibles[mxs], np;
int main() {
  int n, d, i, j, k, l, v, tmp;
  cin >> n >> d;
  for (i = 0; i < n; i++) cin >> data[i];
  fill(possible, possible + mxs, 0);
  possible[0] = 1;
  possibles[0] = 0, np = 1;
  for (i = 0; i < n; i++) {
    tmp = np;
    for (j = 0; j < tmp; j++) {
      v = possibles[j] + data[i];
      if (!possible[v]) {
        possible[v] = true;
        possibles[np++] = v;
      }
    }
  }
  sort(possibles, possibles + np);
  int ndays = 0, sx = 0, bt, sy;
  for (i = 0; i < np;) {
    sy = 0;
    for (; i < np && sx + d >= possibles[i]; i++) {
      sy = possibles[i];
    }
    if (sy > 0)
      ndays++, sx = sy;
    else
      break;
  }
  printf("%d %d\n", sx, ndays);
  return 0;
}
