#include <bits/stdc++.h>
using namespace std;
int n, arr[55], d;
bool can[520005];
int vis[55][500005];
void solve(int idx, int sum) {
  if (idx == n) {
    can[sum] = 1;
    return;
  }
  if (vis[idx][sum]) return;
  vis[idx][sum] = 1;
  solve(idx + 1, sum);
  solve(idx + 1, sum + arr[idx]);
}
int main() {
  cin >> n >> d;
  for (int i = 0; i < n; ++i) scanf("%d", &arr[i]);
  solve(0, 0);
  int cur = 0, s = 0, f = 1;
  while (f) {
    f = 0;
    for (int i = cur + d; i > cur; i--) {
      if (can[i]) {
        f = 1;
        cur = i;
        s++;
        break;
      }
    }
  }
  cout << cur << " " << s << endl;
};
