#include <bits/stdc++.h>
using namespace std;
const double EPS = 0.0000001;
const double PI = acos(-1);
const long long INFLL = 0x7FFFFFFFFFFFFFFF;
const int INF = 0x7FFFFFFF;
template <typename T>
inline void next(T &num) {
  char c;
  num = 0;
  do {
    c = getchar_unlocked();
  } while (c != EOF && c == ' ' && c == '\n' && c == '\t');
  int sign = (c == '-' ? -1 : 1);
  if (c != '-') num += (c - '0');
  while ((c = getchar_unlocked()) != EOF && c != '\n' && c != '\t' &&
         c != ' ') {
    num *= 10;
    num += (c - '0');
  }
  num *= sign;
}
inline string getstr() {
  string str;
  char k;
  while ((k = getchar_unlocked()) == ' ' || k == '\n') {
    k = getchar_unlocked();
    if (k == ' ' || k == '\n')
      continue;
    else
      break;
  }
  str.push_back(k);
  while ((k = getchar_unlocked()) != EOF && k != '\n' && k != '\t' &&
         k != '\v' && k != '\0' && k != ' ')
    str.push_back(k);
  return str;
}
const int N = 500003;
bitset<N> stat;
vector<int> gotten;
int x, n, d;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cin >> n >> d;
  gotten.push_back(0);
  while (n--) {
    cin >> x;
    for (int i = int(0), _b = int(gotten.size() - 1); i <= _b; i++)
      if (!stat[gotten[i] + x]) {
        stat[gotten[i] + x] = 1;
        gotten.push_back(gotten[i] + x);
      }
  }
  sort((gotten).begin(), (gotten).end());
  int cur = 0, ans = 0;
  for (int i = 0; i < gotten.size(); ++ans) {
    while (i < gotten.size() && cur + d >= gotten[i]) ++i;
    if (gotten[i - 1] != cur)
      cur = gotten[i - 1];
    else
      break;
  }
  cout << cur << ' ' << ans;
  return 0;
}
