#include <bits/stdc++.h>
using namespace std;
const int maxix = 60;
const int maxnum = 1000 * 1000 * 1000 + 10;
const int maxd = 50 * 10000 + 10000;
int dp[maxd], mark[maxd];
int arr[maxix];
int main() {
  int n, d;
  cin >> n >> d;
  for (int i = 1; i <= n; i++) {
    cin >> arr[i];
  }
  sort(arr + 1, arr + n + 1);
  int sum = 0;
  int all = 0;
  dp[0] = 1;
  for (int i = 0; i <= n; i++) {
    if (sum + d >= arr[i]) {
      sum += arr[i];
    }
    for (int j = all; j >= 0; j--) {
      if (dp[j] == 1) dp[j + arr[i]] = 1;
    }
    all += arr[i];
  }
  dp[all] = 1;
  for (int i = 0; i < 20; i++) cerr << dp[i] << " ";
  cerr << "\n";
  cout << sum << " ";
  all = 0;
  int day = 0;
  while (true) {
    int index = 0;
    int now = all + d;
    for (int i = now; i >= all; i--) {
      if (dp[i] == 1) {
        index = i;
        break;
      }
    }
    if (index == all) break;
    all = index;
    day++;
  }
  cout << day;
}
