#include <bits/stdc++.h>
using namespace std;
const int N = 55;
int n, d, a[N], dp[N * 10005], gao[N * 10005];
vector<int> v;
int main() {
  int sum = 0;
  cin >> n >> d;
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
    sum += a[i];
  }
  dp[0] = 1;
  for (int i = 1; i <= n; i++) {
    for (int j = sum; j >= a[i]; j--) {
      dp[j] |= dp[j - a[i]];
    }
  }
  for (int i = 0; i <= sum; i++) {
    if (dp[i]) v.push_back(i);
  }
  memset(gao, 0x11, sizeof(dp));
  int now = 0, step = 0;
  while (true) {
    if (now == v.size() - 1) break;
    int nxt = now;
    while (nxt + 1 < v.size() && v[nxt + 1] - v[now] <= d) nxt++;
    if (nxt == now) break;
    now = nxt;
    step++;
  }
  cout << v[now] << " " << step << endl;
  return 0;
}
