#include <bits/stdc++.h>
bool bag[554400];
int main() {
  int i, j, n, d, c;
  int sum, value, days;
  while (~scanf("%d%d", &n, &d)) {
    sum = value = days = 0;
    bag[0] = 1;
    for (i = 0; i < n; i++) {
      scanf("%d", &c);
      for (j = (sum += c); j >= c; j--) bag[j] |= bag[j - c];
    }
    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);
  }
  return 0;
}
