#include <bits/stdc++.h>
const int dx[] = {1, 0, -1, 0};
const int dy[] = {0, 1, 0, -1};
using namespace std;
const int MAXN = 55;
int C[MAXN];
bool ok[MAXN * 10000];
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int n, d;
  cin >> n >> d;
  for (int i = 0; i < n; i++) cin >> C[i];
  ok[0] = true;
  for (int i = 0; i < n; i++) {
    for (int j = MAXN * 10000 - 1; j >= 0; j--) {
      if (ok[j]) ok[j + C[i]] = true;
    }
  }
  int cur = 0;
  for (int cnt = 0;; cnt++) {
    bool ng = true;
    for (int i = cur + d; i > cur; i--) {
      if (ok[i]) {
        ng = false;
        cur = i;
        break;
      }
    }
    if (ng) {
      cout << cur << " " << cnt << endl;
      break;
    }
  }
  return 0;
}
