#include <bits/stdc++.h>
using namespace std;
int n, d, x, sum = 0;
bool val[1000005] = {0};
int main() {
  scanf("%d%d", &n, &d);
  val[0] = 1;
  for (int i = 1; i <= n; ++i) {
    scanf("%d", &x);
    sum = sum + x;
    for (int j = sum; j >= x; --j)
      if (val[j - x]) val[j] = 1;
  }
  int sumc = 0, days = 0;
  while (1) {
    int v = sumc + d;
    while (!val[v] && v > sumc) --v;
    if (v == sumc) break;
    ++days;
    sumc = v;
  }
  printf("%d %d", sumc, days);
  return 0;
}
