#include <bits/stdc++.h>
using namespace std;
const int MAXINT = 1111 * 1111 * 1111;
const long long MAXLINT = MAXINT * 1ll * MAXINT;
const long double EPS = 1e-10;
int n, k;
vector<int> sum;
bool exist[500005];
int main() {
  scanf("%d%d", &n, &k);
  sum.push_back(0);
  for (int i = 0; i < n; i++) {
    int x;
    scanf("%d", &x);
    for (int j = (int)sum.size(); j--;)
      if (sum[j] + x <= 500000 && !exist[sum[j] + x]) {
        sum.push_back(sum[j] + x);
        exist[sum[j] + x] = true;
      }
  }
  sort(sum.begin(), sum.end());
  int ans = 0, val = 0;
  for (int i = 0; i < (int)sum.size();) {
    for (; i < (int)sum.size() && val + k >= sum[i]; i++)
      ;
    if (sum[i - 1] == val) break;
    ans++, val = sum[i - 1];
  }
  printf("%d %d", val, ans);
  return 0;
}
