#include <bits/stdc++.h>
using namespace std;
const int N = 500001;
void solve() {
  int n, d;
  cin >> n >> d;
  bitset<N> bt;
  bt[0] = 1;
  for (int i = 0; i < n; i++) {
    int v;
    cin >> v;
    bt |= (bt << v);
  }
  int sum = 0, days = 0;
  while (1) {
    int flag = 0;
    for (int nsum = min(N - 1, sum + d); nsum > sum; nsum--) {
      if (bt[nsum]) {
        sum = nsum;
        days++;
        flag = 1;
        break;
      }
    }
    if (!flag) break;
  }
  cout << sum << " " << days << "\n";
}
int main() {
  ios::sync_with_stdio(NULL), cin.tie(0), cout.tie(0);
  cout.setf(ios::fixed), cout.precision(20);
  solve();
}
