#include <bits/stdc++.h>
bool bag[554400];
int n, d;
int main() {
  int i, j;
  int sum = 0, value = 0, days = 0;
  scanf("%d%d", &n, &d);
  int x;
  bag[0] = 1;
  for (i = 0; i < n; i++) {
    scanf("%d", &x);
    for (j = (sum += x); j >= x; j--) bag[j] |= bag[j - x];
  }
  while (true) {
    for (j = value + d; j > value; j--)
      if (j <= sum && bag[j]) break;
    if (j == value) break;
    value = j;
    days++;
  }
  printf("%d %d\n", value, days);
}
