#include <bits/stdc++.h>
using namespace std;
inline int in() {
  int32_t x;
  scanf("%d", &x);
  return x;
}
inline string get() {
  char ch[1000000];
  scanf("%s", ch);
  return ch;
}
template <class P, class Q>
inline P smin(P &a, Q b) {
  if (b < a) a = b;
  return a;
}
template <class P, class Q>
inline P smax(P &a, Q b) {
  if (a < b) a = b;
  return a;
}
const int MAX_LG = 17;
const long long INF = 1e9;
const long long maxn = 1e6 + 10;
bool mark[maxn];
long long a[maxn];
long long maxi, day;
int32_t main() {
  long long n = in(), d = in();
  for (long long i = 0; i < n; i++) a[i] = in();
  sort(a, a + n);
  for (long long i = 0; i < n; i++) {
    for (long long j = maxn - 1; j >= 0; j--) {
      if (mark[j] && j + a[i] < maxn) mark[j + a[i]] = true;
    }
    mark[a[i]] = true;
  }
  while (1) {
    long long best = -INF;
    for (long long i = maxi + d; i > maxi; i--) {
      if (mark[i]) {
        best = i;
        break;
      }
    }
    if (best == -INF) break;
    maxi = best, day++;
  }
  cout << maxi << " " << day << "\n";
}
