#include <bits/stdc++.h>
using namespace std;
int val[500005] = {1};
vector<int> V;
int main() {
  int n, d;
  scanf("%d%d", &n, &d);
  for (int i = (0); i < (n); i++) {
    int a;
    scanf("%d", &a);
    for (int i = 500004; i >= a; i--)
      if (val[i - a]) val[i] = 1;
  }
  for (int i = (0); i < (500005); i++)
    if (val[i]) V.push_back(i);
  int p = 0, ans = 0;
  while (1) {
    int _p = upper_bound(V.begin(), V.end(), V[p] + d) - V.begin() - 1;
    if (_p == p) break;
    p = _p;
    ans++;
  }
  printf("%d %d\n", V[p], ans);
  return 0;
}
