#include <bits/stdc++.h>
using namespace std;
bool setExists[500001];
int n;
int d;
int c[50];
int i, j;
int main() {
  cin >> n >> d;
  for (i = 0; i < n; i++) {
    cin >> c[i];
  }
  setExists[0] = true;
  for (i = 1; i <= n * 10000; i++) {
    setExists[i] = false;
  }
  for (i = 0; i < n; i++) {
    for (j = i * 10000; j >= 0; j--) {
      setExists[c[i] + j] = (setExists[c[i] + j] || setExists[j]);
    }
  }
  int curSet = 0;
  int bestOption = 0;
  int mindays = 0;
  for (i = 0; i <= n * 10000; i++) {
    if (i - curSet <= d) {
      if (setExists[i]) {
        bestOption = i;
      }
    } else {
      if (curSet < bestOption) {
        curSet = bestOption;
        mindays++;
        i = curSet;
      } else {
        break;
      }
    }
  }
  if (curSet < bestOption) {
    curSet = bestOption;
    mindays++;
  }
  cout << bestOption << " " << mindays << "\n";
  return 0;
}
