#include <bits/stdc++.h>
using namespace std;
const int MAXN = 6e5 + 9;
bool dp[MAXN];
vector<int> v;
vector<int>::iterator cur, mx;
int main() {
  int n, c, d, i, j, sum;
  while (~scanf("%d%d", &n, &d)) {
    memset(dp, 0, sizeof(dp));
    sum = 0;
    dp[0] = 1;
    for (i = 0; i < n; ++i) {
      scanf("%d", &c);
      for (j = sum; j >= 0; --j) {
        dp[j + c] |= dp[j];
      }
      sum += c;
    }
    for (i = 0; i < MAXN; ++i) {
      if (dp[i]) v.push_back(i);
    }
    int day = 0;
    mx = v.begin();
    while (true) {
      cur = upper_bound(v.begin(), v.end(), (*mx) + d);
      --cur;
      int i1 = mx - v.begin(), i2 = cur - v.begin();
      if (mx == cur) break;
      mx = cur;
      ++day;
    }
    printf("%d %d\n", *mx, day);
  }
  return 0;
}
