#include <bits/stdc++.h>
using namespace std;
const int M = 600000;
int n, d, g[M + 1];
bool f[M + 1];
int main() {
  scanf("%d%d", &n, &d);
  f[0] = 1;
  for (int i = 0, x; i < n; i++) {
    scanf("%d", &x);
    for (int j = M; j >= x; j--) f[j] |= f[j - x];
  }
  for (int i = 1; i <= M; i++) g[i] = (f[i] ? i : g[i - 1]);
  int x = 0, cnt = 0;
  while (true) {
    if (g[x + d] == x)
      printf("%d %d", x, cnt), exit(0);
    else
      x = g[x + d];
    cnt++;
  }
}
