#include <bits/stdc++.h>
using namespace std;
const int MAXLIM = 53 * 10006;
bool poss[MAXLIM];
vector<int> V;
int main() {
  int N, D, i, j, x, last;
  while (scanf("%d %d", &N, &D) != EOF) {
    memset(poss, false, sizeof(poss));
    poss[0] = true;
    for (i = 1; i <= N; ++i) {
      scanf("%d", &x);
      for (j = MAXLIM - x - 1; j >= 0; --j) {
        if (poss[j]) poss[j + x] = true;
      }
    }
    V.clear();
    V.push_back(0);
    for (i = 1; i < MAXLIM; ++i) {
      if (poss[i]) {
        if (V[V.size() - 1] + D < i) break;
        V.push_back(i);
      }
    }
    if (V.size() == 1) {
      puts("0 0");
      continue;
    }
    x = last = 0;
    for (i = 1; i < V.size();) {
      ++x;
      while (i < V.size() && V[last] + D >= V[i]) ++i;
      --i;
      last = i;
      ++i;
    }
    printf("%d %d\n", V[V.size() - 1], x);
  }
  return 0;
}
