#include <bits/stdc++.h>
char pos[500005];
int val[500005];
int main() {
  int i, j, k;
  int n, d;
  int v, ds, m;
  scanf("%d %d", &n, &d);
  for (i = 0; i < 500005; i++) pos[i] = 0;
  pos[0] = 1;
  for (i = 0; i < n; i++) {
    scanf("%d", &k);
    for (j = 500004; j - k >= 0; j--)
      if (pos[j - k] == 1) pos[j] = 1;
  }
  for (i = 0, m = 0; i < 500005; i++)
    if (pos[i] == 1) val[m++] = i;
  for (i = 1, v = 0, ds = 0; i < m; i++)
    if (i == m - 1 or val[i + 1] - v > d) {
      if (val[i] - v > d) break;
      v = val[i];
      ds++;
    }
  printf("%d %d\n", v, ds);
}
