#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:10000000")
using namespace std;
template <class T>
T inline sqr(T x) {
  return x * x;
}
const double pi = 3.1415926535897932384626433832795;
const double eps = 1e-8;
const int maxn = 53;
int a[maxn];
const int maxv = maxn * 10000 + 10;
bool b[maxv];
int main() {
  int n, d;
  cin >> n >> d;
  for (int i = 0; i < (int)(n); ++i) cin >> a[i];
  b[0] = true;
  for (int i = 0; i < (int)(n); ++i) {
    for (int j = maxv - 1; j >= a[i]; j--)
      if (b[j - a[i]]) b[j] = true;
  }
  int c = 0;
  int q = 0;
  while (true) {
    int nc = -1;
    for (int i = c + 1; i <= c + d; i++)
      if (b[i]) nc = i;
    if (nc == -1) break;
    q++, c = nc;
  }
  cout << c << " " << q << endl;
  return 0;
}
