#include <bits/stdc++.h>
using namespace std;
const int MAXX = 500000;
int dp[MAXX + 2];
int main() {
  int n, d, a;
  cin >> n >> d;
  dp[0] = 1;
  for (int i = 0; i < n; i++) {
    cin >> a;
    for (int j = MAXX; j >= 0; j--)
      if (dp[j] == 1 && j + a <= MAXX) dp[j + a] = 1;
  }
  int pos = 0, steps = 0;
  while (1) {
    int i, npos = pos;
    for (i = pos; pos + d >= i && i <= MAXX; i++)
      if (dp[i]) npos = i;
    if (npos == pos)
      break;
    else
      pos = npos, steps++;
  }
  cout << pos << " " << steps << endl;
  return 0;
}
