#include <bits/stdc++.h>
using namespace std;
const int M = 500000 + 10;
int a[M];
int dp[2][M];
vector<int> x;
int main() {
  int n, d;
  cin >> n >> d;
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
  }
  dp[0][0] = 1;
  for (int i = 1; i <= n; i++) {
    int flag = i % 2;
    int pre = 1 - flag;
    for (int j = 0; j < M; j++) {
      int dp1 = dp[pre][j];
      int dp2 = 0;
      if (j - a[i] >= 0) {
        dp2 = dp[pre][j - a[i]];
      }
      int val = dp1 + dp2;
      dp[flag][j] = (val > 0);
    }
  }
  for (int j = 0; j < M; j++) {
    if (dp[n % 2][j] == 1) {
      x.push_back(j);
    }
  }
  int s = 0;
  int cnt = 0;
  while (true) {
    int v = s + d;
    int l = 0;
    int r = x.size() - 1;
    while (l < r) {
      int m = (l + r + 1) / 2;
      if (x[m] <= v) {
        l = m;
      } else {
        r = m - 1;
      }
    }
    if (x[l] == s) {
      break;
    } else {
      s = x[l];
      cnt++;
    }
  }
  cout << s << " " << cnt << endl;
  return 0;
}
