#include <bits/stdc++.h>
using namespace std;
const int MAX = 5e5;
int main() {
  int n, D;
  cin >> n >> D;
  vector<int> c(n);
  for (auto &ci : c) cin >> ci;
  vector<int> dp(MAX + 1);
  dp[0] = true;
  for (auto ci : c) {
    for (int j = MAX; j >= ci; j--) dp[j] |= dp[j - ci];
  }
  int cur = 0, cnt = 0;
  bool update = true;
  while (update) {
    update = false;
    for (int i = min(MAX, cur + D); i > cur; i--)
      if (dp[i]) {
        cur = i, cnt += update = true;
        break;
      }
  }
  cout << cur << " " << cnt << endl;
  return 0;
}
