#include <bits/stdc++.h>
using namespace std;
const int Maxn = 5e5 + 5;
bool dp[Maxn];
int n, d, sum = 0, ans = 0, step = 0;
int main() {
  cin >> n >> d;
  int x;
  dp[0] = true;
  for (int i = 0; i < n; i++) {
    cin >> x;
    for (int j = (sum += x); j >= x; j--) dp[j] |= dp[j - x];
  }
  while (1) {
    int j;
    for (j = ans + d; j > ans; j--)
      if (j <= sum && dp[j]) break;
    if (j == ans) break;
    ans = j, step++;
  }
  cout << ans << " " << step << endl;
  return 0;
}
