#include <bits/stdc++.h>
bool pres[512345];
int main() {
  int n, d, val;
  pres[0] = 1;
  scanf("%d %d", &n, &d);
  for (int i = 0; i < n; i++) {
    scanf("%d", &val);
    for (int i = 512344; i >= val; i--) {
      pres[i] = (pres[i] || pres[i - val]);
    }
  }
  int ini = -1, fim = 1, next = 0, resp = -1;
  while (ini != next) {
    resp++;
    ini = next;
    for (; fim <= ini + d; fim++) {
      if (pres[fim]) {
        next = fim;
      }
    }
  }
  printf("%d %d\n", ini, resp);
  return 0;
}
