#include <bits/stdc++.h>
using namespace std;
const double eps = 1.0e-11;
const double pi = acos(-1.0);
const int N = 55;
const int M = 10100;
int c[N];
int dp[N * M];
int main() {
  int n, d;
  scanf("%d%d", &n, &d);
  for (long long i = 0; i < n; i++) scanf("%d", c + i);
  sort(c, c + n);
  dp[0] = 1;
  for (long long i = 0; i < n; i++) {
    for (long long j = N * M - c[i] - 1; j >= 0; --j) {
      dp[j + c[i]] |= dp[j];
    }
  }
  int curr = 0, res = 0, last = 0;
  for (long long i = 0; i < N * M; i++) {
    if (dp[i]) {
      if (curr + d < i) {
        if (last == curr) {
          cout << last << " " << res << endl;
          return 0;
        }
        if (curr + d < last) break;
        curr = last;
        ++res;
      }
      last = i;
    }
  }
  if (last != curr && curr + d >= last) ++res, curr = last;
  cout << curr << " " << res << endl;
  return 0;
}
