#include <bits/stdc++.h>
using namespace std;
const int MAXN = 500010;
bool f[MAXN];
int a[MAXN];
vector<int> sta;
int main() {
  int n, d;
  while (scanf("%d%d", &n, &d) != EOF) {
    memset(f, false, sizeof(f));
    f[0] = true;
    int tot = 0;
    for (int i = 1; i <= n; i++) {
      scanf("%d", &a[i]);
      tot += a[i];
    }
    for (int i = 1; i <= n; i++)
      for (int j = tot; j >= a[i]; j--) f[j] |= f[j - a[i]];
    sta.clear();
    for (int i = 0; i <= tot; i++)
      if (f[i]) {
        sta.push_back(i);
      }
    int day = 0, p = 0;
    int size = sta.size();
    while (true) {
      if (p + 1 >= size) break;
      if (sta[p + 1] > sta[p] + d) break;
      int nxt = p + 1;
      while (nxt < size && sta[nxt] <= sta[p] + d) nxt++;
      p = nxt - 1;
      day++;
    }
    printf("%d %d\n", sta[p], day);
  }
  return 0;
}
