#include <bits/stdc++.h>
using namespace std;
const long long INF = (long long)1e18;
signed main() {
  ios::sync_with_stdio(0);
  cin.tie(nullptr);
  cout.tie(nullptr);
  long long n, d;
  cin >> n >> d;
  long long m[n];
  bitset<(long long)6e5> B;
  for (long long i = 0; i < n; i++) {
    cin >> m[i];
    B[i] = 0;
  }
  B[0] = 1;
  for (long long i = 0; i < n; i++) {
    B |= (B << m[i]);
  }
  long long ans = 0;
  long long days = 0;
  while (true) {
    bool upd = 0;
    for (long long i = ans + d; i > ans; i--) {
      if (B[i]) {
        upd = 1;
        ans = i;
        break;
      }
    }
    if (!upd) break;
    days++;
  }
  cout << ans << " " << days << "\n";
  return 0;
}
