#include <bits/stdc++.h>
using namespace std;
const int maxn = 10000 + 233;
bool ok[maxn * 55];
int f[maxn * 55];
vector<int> a;
int main() {
  int n, d;
  cin >> n >> d;
  memset(ok, 0, sizeof(ok));
  ok[0] = 1;
  int sum = 0;
  for (int i = 1; i <= n; i++) {
    int x;
    cin >> x;
    for (int i = sum; i >= 0; i--)
      if (ok[i]) ok[i + x] = 1;
    sum += x;
  }
  for (int i = 0; i <= sum; i++)
    if (ok[i]) a.push_back(i);
  memset(f, -1, sizeof(f));
  f[0] = 0;
  int ans = 0, buf = 0;
  for (int i = 1; i < a.size(); i++) {
    int k = lower_bound(a.begin(), a.end(), a[i] - d) - a.begin();
    if (a[i] == a[k]) break;
    f[a[i]] = f[a[k]] + 1;
    ans = a[i];
    buf = f[a[i]];
  }
  cout << ans << " " << buf << endl;
  return 0;
}
