#include <bits/stdc++.h>
using namespace std;
int n, d;
bitset<55 * 10000> b(1);
int main() {
  ios_base::sync_with_stdio(false);
  cin >> n >> d;
  for (int i = 0, _n = (int)(n); i < _n; i++) {
    int x;
    cin >> x;
    b |= b << x;
  }
  int cur = 0, dis = -1;
  for (int old = -1; old != cur; dis++)
    for (int i = old = cur, ed = cur + d; i <= ed; i++)
      if (b.test(i)) cur = i;
  cout << cur << ' ' << dis << endl;
  {
    int _;
    cin >> _;
    return 0;
  }
}
