#include <bits/stdc++.h>
long long mpow(long long a, long long n, long long mod) {
  long long ret = 1;
  long long b = a;
  while (n) {
    if (n & 1) ret = (ret * b) % mod;
    b = (b * b) % mod;
    n >>= 1;
  }
  return (long long)ret;
}
using namespace std;
bool a[6000001];
int x[51];
int main() {
  int n, d, i, j;
  cin >> n >> d;
  for (j = 0; j < n; j++) cin >> x[j];
  int sum = 0;
  a[0] = true;
  for (i = 0; i < n; i++) {
    sum += x[i];
    for (j = sum; j >= x[i]; j--) {
      a[j] |= a[j - x[i]];
    }
  }
  int cnt = 0, res = 0;
  for (;; cnt++) {
    for (j = d; j; j--) {
      if (a[res + j]) {
        res += j;
        break;
      }
    }
    if (!j) break;
  }
  cout << res << " " << cnt;
  return 0;
}
