#include <bits/stdc++.h>
using namespace std;
bool dp[1000010];
int main() {
  int n, d, c;
  cin >> n >> d;
  dp[0] = 1;
  for (int i = 1; i <= n; i++) {
    cin >> c;
    for (int j = 500000; j >= c; j--) dp[j] |= dp[j - c];
  }
  int day = 0, now = 0;
  bool ok = 1;
  while (ok) {
    for (int i = now + d; i > now; i--) {
      if (dp[i]) {
        now = i;
        break;
      }
      if (i <= now + 1) ok = 0;
    }
    day++;
  }
  cout << now << ' ' << day - 1 << endl;
  return 0;
}
