#include <bits/stdc++.h>
bool book[510001];
int main() {
  int n, d;
  memset(book, false, sizeof(book));
  scanf("%d%d", &n, &d);
  int i, j;
  int max = 0, x;
  book[0] = true;
  for (i = 0; i < n; i++) {
    scanf("%d", &x);
    for (j = (max += x); j >= x; j--) {
      if (book[j - x]) book[j] = true;
    }
  }
  int ans = 0, day = 0;
  while (1) {
    j = ans + d;
    while (!book[j] && (j > ans)) j--;
    if (j == ans) break;
    ans = j;
    day++;
  }
  printf("%d %d\n", ans, day);
  return 0;
}
