#include <bits/stdc++.h>
using namespace std;
int n, d, mx = 0;
int c[60], ok[500010] = {0}, dp[500010];
vector<int> v;
int main() {
  scanf("%d%d", &n, &d);
  ok[0] = 1;
  for (int i = 1; i <= n; i++) {
    scanf("%d", &c[i]);
    mx += c[i];
  }
  for (int i = 1; i <= n; i++)
    for (int j = mx; j >= c[i]; j--) ok[j] |= ok[j - c[i]];
  for (int i = 0; i <= mx; i++)
    if (ok[i]) v.push_back(i);
  memset(dp, -1, sizeof(dp));
  dp[0] = 0;
  int day = 0, val = 0, l = v.size();
  for (int i = 0; i < l; i++) {
    if (dp[i] < 0) continue;
    int p = upper_bound(v.begin(), v.end(), v[i] + d) - v.begin() - 1;
    if (p < 0) continue;
    if (dp[p] < 0 || dp[i] + 1 <= dp[p]) {
      dp[p] = dp[i] + 1;
      day = dp[p];
      val = v[p];
    }
  }
  printf("%d %d\n", val, day);
  return 0;
}
