#include <bits/stdc++.h>
using namespace std;
const long long N = 50;
const long long A = 1e4;
const long long second = N * A;
bool possible[second + 1];
long long dp[second + 1];
deque<pair<long long, long long> > slidingWindow;
int main() {
  for (long long s = 0; s <= second; s++) {
    possible[s] = false;
    dp[s] = 1000000000000000000LL;
  }
  long long n, d;
  cin >> n >> d;
  possible[0] = true;
  for (long long i = 1; i <= n; i++) {
    long long a;
    cin >> a;
    for (long long s = second; s >= 0; s--) {
      if (possible[s]) {
        possible[s + a] = true;
      }
    }
  }
  dp[0] = 0;
  slidingWindow.push_back(make_pair(0, 0));
  for (long long s = 1; s <= second; s++) {
    if (!possible[s]) {
      continue;
    }
    while (!slidingWindow.empty() && (slidingWindow.front().first < (s - d))) {
      slidingWindow.pop_front();
    }
    if (slidingWindow.empty()) {
      break;
    }
    dp[s] = 1 + slidingWindow.front().second;
    while (!slidingWindow.empty() && slidingWindow.back().second >= dp[s]) {
      slidingWindow.pop_back();
    }
    slidingWindow.push_back(make_pair(s, dp[s]));
  }
  for (long long s = second; s >= 0; s--) {
    if (dp[s] < 1000000000000000000LL) {
      cout << s << " " << dp[s] << endl;
      return 0;
    }
  }
}
