#include <bits/stdc++.h>
using namespace std;
const int INF = INT_MAX;
const long long INFL = LLONG_MAX;
const int output_precision = 15;
const bool debug = true;
stringstream ss;
int N, D, C[1000];
bool f[500100];
int main() {
  ios_base::sync_with_stdio(0);
  cout.precision(output_precision);
  cout << fixed;
  ss.precision(output_precision);
  ss << fixed;
  cin >> N >> D;
  for (int(i) = 1, j1234 = N; (i) <= j1234; (i)++) cin >> C[i];
  sort(C + 1, C + N + 1);
  f[0] = 1;
  for (int(i) = 1, j1234 = N; (i) <= j1234; (i)++)
    for (int ii = N * 10000 - C[i] + 1; ii >= 0; ii--)
      if (f[ii]) f[C[i] + ii] = 1;
  int from = 0;
  int cnt = 0;
  while (true) {
    int mx = -1;
    int cur = from + 1;
    while (cur <= N * 10000 && from + D >= cur) {
      if (f[cur]) {
        mx = cur;
      }
      cur++;
    }
    if (mx == -1) {
      break;
    } else {
      cnt++;
      from = mx;
    }
  }
  cout << from << " " << cnt << '\n';
}
