#include <bits/stdc++.h>
using namespace std;
int n, d, s, ans, a[55];
bitset<500005> b;
int main() {
  scanf("%d%d", &n, &d);
  for (int i = 0; i < n; ++i) scanf("%d", a + i);
  sort(a, a + n);
  for (int i = 0; i < n; ++i)
    if (s + d < a[i]) {
      n = i;
      break;
    } else
      s += a[i];
  b[0] = 1;
  for (int i = 0; i < n; ++i) b |= b << a[i];
  int x = 0, y = 0, j = 0;
  while (x < s) {
    while (j <= x + d) {
      if (b[j]) y = j;
      ++j;
    }
    x = y, ++ans;
  }
  printf("%d %d\n", x, ans);
  return 0;
}
