#include <bits/stdc++.h>
using namespace std;
bool pd[505000];
int n, d;
int c[100], aux[505000];
int main() {
  memset(pd, 0, sizeof pd);
  scanf("%d%d", &n, &d);
  pd[0] = true;
  for (int i = 0; i < n; ++i) scanf("%d", c + i);
  for (int i = 0; i < n; ++i)
    for (int j = 505000 - 1; j >= c[i]; --j) {
      pd[j] |= pd[j - c[i]];
    }
  int a = 0, last = 0, dias = 0;
  for (int i = 0; i < 505000; ++i)
    if (pd[i]) aux[a++] = i;
  int i = 0;
  while (i < a) {
    int x = i;
    while (i < a && aux[i] - last <= d) ++i;
    if (x == i) break;
    if (i) last = aux[i - 1], ++dias;
  }
  if (!last) dias = 0;
  printf("%d %d\n", last, dias);
}
