#include <bits/stdc++.h>
using namespace std;
int f[1000000 * 2], c[10000 * 2], n, now, t, d;
int main() {
  scanf("%d%d", &n, &d), f[0] = 1;
  for (int i = 1; i <= n; i++) scanf("%d", &c[i]);
  for (int i = 1; i <= n; i++)
    for (int j = 1000000; j >= c[i]; j--)
      if (f[j - c[i]] == 1) f[j] = 1;
  for (now = 0, t = 0; t <= 550000; t++) {
    int e = now + d;
    for (int i = e; i >= now; i--)
      if (f[i] == 1) {
        now = i;
        break;
      }
    if (e == now + d) break;
  }
  return 0 * printf("%d %d\n", now, t);
}
