#include <bits/stdc++.h>
using namespace std;
int n, d, a[55], f[500005][55], s[1000005];
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(NULL);
  cin >> n >> d;
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
  }
  fill(f[0], f[0] + n + 2, 1);
  vector<int> v(1);
  for (int i = 1; i < 500005; i++) {
    for (int j = 1; j <= n; j++) {
      f[i][j] = f[i][j - 1];
      if (i >= a[j] && f[i - a[j]][j - 1]) {
        f[i][j] = 1;
      }
    }
    if (f[i][n]) {
      v.push_back(i);
    }
  }
  for (int i = 1;; i++) {
    s[i] = *(upper_bound(v.begin(), v.end(), s[i - 1] + d) - 1);
    if (s[i] == s[i - 1]) {
      cout << s[i - 1] << " " << i - 1 << "\n";
      return 0;
    }
  }
  return 0;
}
