#include <bits/stdc++.h>
using namespace std;
typedef long double real;
int n, d;
vector<int> L;
bool sum[500001];
int main() {
  scanf("%d %d", &n, &d);
  L.resize(n);
  for (int i = 0; i < n; ++i) {
    scanf("%d", &L[i]);
  }
  sum[0] = true;
  for (int i = 0; i < n; ++i) {
    for (int j = 500001 - 1; 0 <= j; --j) {
      if (sum[j]) {
        sum[j + L[i]] = true;
      }
    }
  }
  int days = 0;
  int s = 0;
  while (s + 1 < 500001) {
    int best = -1;
    for (int ptr = s + 1; ptr <= min(s + d, 500001 - 1); ++ptr) {
      if (sum[ptr]) {
        best = ptr;
      }
    }
    if (best == -1) {
      break;
    }
    s = best;
    ++days;
  }
  printf("%d %d\n", s, days);
}
