#include <bits/stdc++.h>
using namespace std;
const int modul = 1000000007;
const int nmax = 51;
const double e = 1e-8;
const double pi = acos(-1);
int n, s[nmax], a[nmax], dp[nmax][nmax * 10010], d;
int main() {
  ios::sync_with_stdio(false);
  cin >> n >> d;
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
    s[i] = s[i - 1] + a[i];
  }
  dp[0][0] = true;
  for (int i = 0; i <= n - 1; i++)
    for (int j = 0; j <= s[i]; j++)
      if (dp[i][j]) {
        dp[i + 1][j] = true;
        dp[i + 1][j + a[i + 1]] = true;
      }
  int res = 0, ans = 0;
  while (true) {
    bool Find = false;
    for (int i = min(res + d, s[n]); i >= res + 1; i--)
      if (dp[n][i]) {
        res = i;
        ans++;
        Find = true;
      }
    if (!Find) break;
  }
  cout << res << " " << ans << endl;
  return 0;
}
