#include <bits/stdc++.h>
using namespace std;
const int N = 1e6 + 5, mod = 1e9 + 7;
int Hot[N];
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  int n, d;
  cin >> n >> d;
  while (n--) {
    int x;
    cin >> x;
    for (int i = N - 1; i >= x; i--) Hot[i] = max(Hot[i], Hot[i - x] + x);
  }
  int Res = 0, day = 0;
  while (true) {
    if (Hot[Res + d] > Res) {
      Res = Hot[Res + d];
      day++;
    } else
      break;
  }
  cout << Res << " " << day << "\n";
  return 0;
}
