#include <bits/stdc++.h>
using namespace std;
bool dp[500010];
int main() {
  int n, d;
  cin >> n >> d;
  vector<int> c(n);
  for (int i = int(0); i <= int((n)-1); i++) cin >> c[i];
  dp[0] = true;
  for (int i = 0; i < n; i++) {
    for (int j = 500001; j >= 0; j--) {
      if (dp[j]) dp[j + c[i]] = true;
    }
  }
  vector<int> nums;
  for (int i = int(0); i <= int((500010) - 1); i++)
    if (dp[i]) nums.push_back(i);
  nums.push_back(1111111);
  int price = 0, day = 0;
  while (1) {
    auto next = upper_bound((nums).begin(), (nums).end(), price + d) - 1;
    if (*next == price) {
      cout << price << " " << day << endl;
      return 0;
    }
    price = *next;
    day++;
  }
}
