#include <bits/stdc++.h>
using namespace std;
template <class T>
T sqr(T x) {
  return x * x;
}
int f[600001];
int n, d, x;
int main() {
  scanf("%d%d", &n, &d);
  f[0] = 1;
  int tot = 0;
  for (int i = 1; i <= n; i++) {
    scanf("%d", &x);
    tot += x;
    for (int j = tot; j >= x; j--)
      if (f[j - x]) f[j] = 1;
  }
  vector<int> tree;
  for (int i = 0; i <= tot; i++)
    if (f[i]) tree.push_back(i);
  int tem = 0;
  int cnt = 0;
  while (1) {
    auto ps = upper_bound(tree.begin(), tree.end(), tem + d) - tree.begin();
    ps--;
    if (tree[ps] == tem) {
      cout << tem << " " << cnt << endl;
      return 0;
    }
    cnt++;
    tem = tree[ps];
  }
}
