#include <bits/stdc++.h>
using namespace std;
const int oo = 0x3f3f3f3f;
const double eps = 1e-9;
int n, d;
int c[60];
int main() {
  cin >> n >> d;
  for (int i = (0); i < (n); i++) cin >> c[i];
  set<int> vals;
  vals.insert(0);
  vector<int> tmp;
  for (int i = (0); i < (n); i++) {
    tmp.clear();
    for (__typeof__((vals).begin()) it = (vals).begin(); it != (vals).end();
         it++) {
      tmp.push_back(*it + c[i]);
    }
    vals.insert((tmp).begin(), (tmp).end());
  }
  vals.insert(oo);
  int v = 0;
  int days = 0;
  int last = 0;
  for (__typeof__((vals).begin()) it = (vals).begin(); it != (vals).end();
       it++) {
    if (*it > v + d) {
      if (last == v) {
        break;
      } else {
        v = last;
        days++;
        it--;
      }
    }
    last = *it;
  }
  cout << v << " " << days << endl;
  return 0;
}
