#include <bits/stdc++.h>
using namespace std;
int n, d, w, nex, cnt;
int a[55], f[550005];
int inline read() {
  int x = 0, f = 1;
  char ch = getchar();
  while (ch < '0' || ch > '9') {
    if (ch == '-') f = -1;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9') {
    x = x * 10 + ch - '0';
    ch = getchar();
  }
  return x * f;
}
int main() {
  n = read(), d = read();
  f[0] = 1;
  for (int i = 1; i <= n; i++) {
    a[i] = read();
    for (int j = 500000; j >= a[i]; j--) f[j] |= f[j - a[i]];
  }
  w = 0;
  while (1) {
    nex = w + d;
    while (nex > w && !f[nex]) nex--;
    if (nex == w) break;
    w = nex;
    cnt++;
  }
  printf("%d %d", w, cnt);
  return 0;
}
