#include <bits/stdc++.h>
using namespace std;
int a[500003];
vector<int> p;
int main() {
  int N, D, u;
  cin >> N >> D;
  for (int i = 0; i < 500003; ++i) {
    a[i] = 0;
  }
  a[0] = 1;
  p.push_back(0);
  for (int i = 0; i < N; ++i) {
    cin >> u;
    for (int j = p.size(); j--;) {
      if (p[j] + u < 500003 && !a[p[j] + u]) {
        a[p[j] + u] = 1;
        p.push_back(p[j] + u);
      }
    }
  }
  int days = 0;
  int now = 0;
  while (1) {
    bool moved = false;
    for (int i = D + 1; i--;) {
      if (i == 0) break;
      if (now + i < 500003 && a[now + i]) {
        ++days;
        now += i;
        moved = true;
        break;
      }
    }
    if (!moved) break;
  }
  cout << now << " " << days << endl;
  return 0;
}
