#include <bits/stdc++.h>
using namespace std;
const int maxn = 55 * 10007;
vector<int> v;
bool mark[10000000];
int main() {
  int n, d;
  cin >> n >> d;
  for (int i = 1; i <= n; i++) {
    int x;
    cin >> x;
    v.push_back(x);
  }
  sort(v.begin(), v.end());
  mark[0] = 1;
  for (int i = 0; i <= n; i++) {
    for (int j = maxn; j >= 0; j--)
      if (mark[j] == 1) mark[j + v[i]] = 1;
  }
  int maxi = 0, day = 0;
  while (true) {
    int p = -1;
    for (int i = maxi + d; i > maxi; i--) {
      if (mark[i] == 1) {
        p = i;
        break;
      }
    }
    if (p == -1) break;
    maxi = p;
    day++;
  }
  cout << maxi << " " << day << endl;
}
