#include <bits/stdc++.h>
using namespace std;
const int MAXS = 50 * 10000;
const int INF = 1000000000;
int main() {
  ios_base::sync_with_stdio(0);
  int n, d;
  cin >> n >> d;
  vector<int> c(n);
  for (int i = 0; i < n; ++i) cin >> c[i];
  vector<bool> sumy(MAXS + 1, false);
  sumy[0] = true;
  for (int i = 0; i < n; ++i)
    for (int j = MAXS; j >= 0; --j)
      if (j - c[i] >= 0 && sumy[j - c[i]]) sumy[j] = true;
  vector<int> dp(MAXS + 1);
  multiset<int> ost;
  dp[0] = 0;
  for (int i = 1; i <= MAXS; ++i) {
    ost.insert(dp[i - 1]);
    if (i - d - 1 >= 0) ost.erase(ost.find(dp[i - d - 1]));
    if (*ost.begin() != INF && sumy[i])
      dp[i] = *ost.begin() + 1;
    else
      dp[i] = INF;
  }
  int i = MAXS;
  while (dp[i] == INF) --i;
  cout << i << " " << dp[i];
  return 0;
}
