#include <bits/stdc++.h>
using namespace std;
bool achieve[5000001];
int main() {
  achieve[0] = true;
  int n, k;
  cin >> n >> k;
  for (int i = 0; i < n; i++) {
    int a;
    cin >> a;
    for (int j = 5000001 - a - 1; j >= 0; --j) {
      if (achieve[j]) achieve[j + a] = true;
    }
  }
  int current = 0;
  int m = 0;
  for (;;) {
    int best = -1;
    for (int i = current + 1; i <= current + k; i++) {
      if (achieve[i]) best = i;
    }
    if (best != -1) {
      current = best;
      m++;
    } else
      break;
  }
  cout << current << ' ' << m << '\n';
}
