#include <bits/stdc++.h>
using namespace std;
int n, d, a[60], t;
bool best[500100];
vector<int> s;
int main() {
  cin >> n >> d;
  for (int i = 1; i <= n; ++i) {
    cin >> a[i];
    t += a[i];
  }
  best[0] = 1;
  for (int i = 1; i <= n; ++i)
    for (int j = t - a[i]; j >= 0; --j) {
      best[j + a[i]] = max(best[j], best[j + a[i]]);
    }
  for (int i = 0; i <= t; ++i)
    if (best[i] == 1) {
      s.push_back(i);
    }
  int x = 0, y = 0, z = 0, rez = 0;
  while (s[x] + d >= s[x + 1] && x < s.size() - 1) {
    ++x;
    y = s[x] - z;
    if (y == d) {
      ++rez;
      z = s[x];
    } else if (y > d) {
      ++rez;
      z = s[x - 1];
    }
  }
  if (x && s[x] - z < d && s[x] - z > 0) ++rez;
  cout << s[x] << " " << rez;
  return 0;
}
