#include <bits/stdc++.h>
using namespace std;
int n, d, x, j;
int c[1000000];
int dp[1000000];
int sum[1000000];
int main() {
  cin >> n >> d;
  c[0] = 1;
  for (int i = 0; i < n; i++) {
    cin >> x;
    for (int j = 500000; j >= 0; j--)
      if (c[j]) c[j + x] = 1;
  }
  int last = 0;
  int Min = 0;
  int sz = 1;
  int j = 0;
  dp[0] = 0;
  sum[0] = 0;
  for (int i = 1; i <= 500000; i++)
    if (c[i]) {
      while ((j < sz) && (sum[j] + d < i)) j++;
      if (j == sz) break;
      dp[sz] = dp[j] + 1;
      sum[sz] = i;
      Min = dp[sz];
      last = sum[sz];
      sz++;
    }
  cout << last << " " << Min << endl;
  return 0;
}
