#include <bits/stdc++.h>
using namespace std;
const int N = 60;
const int L = 5e5 + 10;
const int INF = 1e9 + 10;
int n, d;
int c[N];
bool f[L];
int dp[L];
int mx;
int main() {
  scanf("%d%d", &n, &d);
  for (int i = 0; i < n; ++i) {
    scanf("%d", c + i);
  }
  sort(c, c + n);
  f[0] = 1;
  for (int i = 0; i < n; ++i) {
    for (int j = L - 1; j >= 0; --j) {
      if (f[j]) f[j + c[i]] = 1;
    }
  }
  fill(dp, dp + L, INF);
  dp[0] = 0;
  int j = 0;
  for (int i = 0; i < L; ++i) {
    if (f[i]) {
      if (dp[i] >= INF) {
        break;
      }
      for (; j - i <= d && j < L; ++j) {
        if (f[j]) {
          mx = j;
          dp[j] = min(dp[j], dp[i] + 1);
        }
      }
    }
  }
  printf("%d %d\n", mx, dp[mx]);
  return 0;
}
