#include <bits/stdc++.h>
using namespace std;
template <typename T1, typename T2>
inline void mine(T1 &x, T2 y) {
  if (x > y) x = y;
}
template <typename T1, typename T2>
inline void maxe(T1 &x, T2 y) {
  if (x < y) x = y;
}
ostream &operator<<(ostream &a, const vector<long long> &b) {
  for (auto k : b) cout << k << ' ';
  return a;
}
const long long MOD = 1000000007;
const long long INF = 1000000050;
const long long BIG = (long long)2e18 + 50;
const long long MX = 500010;
const double EPS = 1e-9;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long n, d;
  cin >> n >> d;
  bitset<MX> can;
  can[0] = 1;
  for (long long i = 0; i < n; i++) {
    long long x;
    cin >> x;
    can |= can << x;
  }
  long long day = 0;
  long long mx = 0;
  for (long long i = 1; i < MX; i++) {
    bool done = false;
    for (long long j = mx + d + 1 - 1; j >= mx + 1; j--) {
      if (can[j]) {
        mx = j;
        day++;
        done = true;
        break;
      }
    }
    if (!done) break;
  }
  cout << mx << ' ' << day << '\n';
}
