#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e4 + 10;
int dp[55 * maxn];
int main() {
  int n, d, x, cnt = 0, w = 0, i, j;
  cin >> n >> d;
  memset(dp, 0, sizeof(dp));
  dp[0] = 1;
  long long sum = 0;
  for (i = 1; i <= n; i++) {
    cin >> x;
    sum += x;
    for (j = sum; j >= x; j--)
      if (dp[j - x]) dp[j] = 1;
  }
  while (0 == 0) {
    j = w + d;
    while (!dp[j] && j > w) j--;
    if (j == w) break;
    w = j;
    cnt++;
  }
  printf("%d %d", w, cnt);
  return 0;
}
