#include <bits/stdc++.h>
using namespace std;
int vis[55][500005];
int sum[500005];
int one[55];
void solve() {
  int n, d;
  while (cin >> n >> d) {
    vector<int> C;
    int i, x, j;
    memset(vis, 0, sizeof vis);
    memset(sum, 0, sizeof sum);
    memset(one, 0, sizeof one);
    for (i = 1; i <= n; i++) {
      scanf("%d", &x);
      C.push_back(x);
    }
    sort(C.begin(), C.end());
    one[0] = C[0];
    for (i = 1; i < C.size(); i++) one[i] = one[i - 1] + C[i];
    vis[0][0] = 1;
    for (i = 0; i < n; i++)
      for (j = 0; j <= i * 10000; j++)
        if (vis[i][j]) vis[i + 1][j + C[i]] = 1, vis[i + 1][j] = 1;
    vector<int> L;
    vector<int>::iterator iter;
    for (i = 0; i <= n * 10000; i++)
      if (vis[n][i]) L.push_back(i);
    int now = 0, tot = 0;
    while (1) {
      int l = 0, r = L.size() - 1;
      int h;
      while (r >= l) {
        if (r - l <= 1) {
          if (L[r] - now <= d)
            h = r;
          else if (L[l] - now <= d)
            h = l;
          else
            h = -1;
          break;
        }
        int mid = (l + r) >> 1;
        if (L[mid] - now > d)
          r = mid;
        else
          l = mid;
      }
      if (h == -1) break;
      if (L[h] > now)
        now = L[h];
      else
        break;
      tot++;
    }
    cout << now << " " << tot << endl;
  }
}
int main() {
  solve();
  return 0;
}
