#include <bits/stdc++.h>
using namespace std;
const long long maxN = 1e6 + 5;
const long long inf = 1e10;
const long long mod = 1e9 + 7;
long long n, d;
long long f[maxN];
long long x;
long long used[maxN];
vector<long long> a;
int main() {
  ios_base::sync_with_stdio(0);
  cin >> n >> d;
  used[0] = 1;
  a.push_back(0);
  for (long long i = 1; i <= n; i++) {
    cin >> x;
    for (long long j = a.size() - 1; j >= 0; j--) {
      if (a[j] + x < maxN && used[a[j] + x] == 0) {
        used[a[j] + x] = 1;
        a.push_back(a[j] + x);
      }
    }
  }
  sort(a.begin(), a.end());
  long long i = 0;
  long long ans = 0;
  long long now = 0;
  while (i < a.size()) {
    while (now + d >= a[i] && i < a.size()) i++;
    if (a[i - 1] != now)
      now = a[i - 1];
    else
      break;
    ans++;
  }
  cout << now << " " << ans;
  return 0;
}
