#include <bits/stdc++.h>
using namespace std;
int n, d, all = 0, ans;
bool f[900001];
int g[901001], c[100];
map<int, int> ma;
int main() {
  srand(time(NULL));
  ios_base::sync_with_stdio(0);
  f[0] = 1;
  cin >> n >> d;
  for (int i = 1; i <= n; ++i) {
    cin >> c[i];
    all += c[i];
  }
  for (int i = 1; i <= n; ++i) {
    for (int j = all; j >= c[i]; --j)
      if (f[j - c[i]]) {
        f[j] = 1;
      }
  }
  for (int i = 1; i <= all; ++i) g[i] = 1000000000;
  int l = 0;
  g[0] = 0;
  ma[0]++;
  for (int i = 1; i <= all; ++i) {
    int r = i;
    while (r - l > d) {
      --ma[g[l]];
      if (ma[g[l]] == 0) ma.erase(g[l]);
      ++l;
    }
    if (!f[r]) {
      ++ma[g[r]];
      continue;
    }
    int tmp = ma.begin()->first;
    if (tmp < 1000000000) {
      ans = i;
      g[ans] = tmp + 1;
    }
    ++ma[g[r]];
  }
  cout << ans << " " << g[ans];
  return 0;
}
