#include <bits/stdc++.h>
using namespace std;
const int N = 500000;
bool ok[N + 10];
int dist[N + 10];
int main() {
  int n, d;
  cin >> n >> d;
  vector<int> c(n);
  for (int i = 0; i < (n); i++) cin >> c[i];
  ok[0] = 1;
  for (int i = 0; i < (n); i++) {
    for (int j = N; j >= c[i]; j--) {
      if (ok[j - c[i]]) ok[j] = 1;
    }
  }
  vector<int> v;
  for (int i = 0; i < (N + 10); i++) {
    if (ok[i]) v.push_back(i);
  }
  memset(dist, -1, sizeof(dist));
  dist[0] = 0;
  for (int i = 0; i < (v.size()); i++) {
    if (dist[i] < 0) continue;
    int pos = upper_bound((v).begin(), (v).end(), v[i] + d) - v.begin() - 1;
    if (pos < 0) continue;
    if (dist[pos] < 0 || dist[pos] > dist[i] + 1) {
      dist[pos] = dist[i] + 1;
    }
  }
  int ans = 0, days = 0;
  for (int i = v.size() - 1; i >= 0; i--) {
    if (dist[i] > 0) {
      ans = v[i], days = dist[i];
      break;
    }
  }
  cout << ans << ' ' << days << endl;
  return 0;
}
