#include <bits/stdc++.h>
using namespace std;
const int MAXN = 510000;
bool f[MAXN];
int main() {
  int n, d;
  scanf("%d%d", &n, &d);
  f[0] = 1;
  for (int i = 0, x; i < n; i++) {
    scanf("%d", &x);
    for (int j = MAXN - x - 1; j >= 0; --j) {
      f[j + x] |= f[j];
    }
  }
  f[0] = 0;
  int r = 0, sum = 0, ans = 0;
  while (r < MAXN) {
    int nxt = -1;
    while (r <= sum + d && r < MAXN) {
      if (f[r]) nxt = r;
      r++;
    }
    if (nxt == -1) break;
    sum = nxt;
    ans++;
  }
  printf("%d %d\n", sum, ans);
  return 0;
}
