#include <bits/stdc++.h>
using namespace std;
const int maxn = 55, maxv = 500005;
int n, D, a[maxn], f[maxv], b[maxv], now, cnt;
int main() {
  scanf("%d%d", &n, &D);
  for (int i = 1; i <= n; i++) scanf("%d", &a[i]);
  f[0] = 1;
  for (int i = 1; i <= n; i++)
    for (int j = 500000; j >= a[i]; j--) f[j] |= f[j - a[i]];
  for (int i = 0; i <= 500000; i++)
    if (f[i]) b[++b[0]] = i;
  b[b[0] + 1] = 1e9;
  now = 1;
  cnt = 0;
  for (int i = 2; i <= b[0]; i++) {
    if (b[i] <= b[now] + D && b[now] + D < b[i + 1]) cnt++, now = i;
  }
  printf("%d %d\n", b[now], cnt);
  return 0;
}
