#include <bits/stdc++.h>
using namespace std;
const int maxn = 510000;
int f[maxn];
int n, d, up;
int c[66];
int b[66];
int main() {
  cin >> n >> d;
  f[0] = 1;
  for (int i = 1; i <= n; i++) {
    int x;
    cin >> x;
    for (int j = (up += x); j >= x; j--)
      if (f[j - x]) f[j] = 1;
  }
  int num = 0, ans = 0;
  while (true) {
    int to = ans + d;
    while (!f[to] && to > ans) to--;
    if (ans == to) break;
    ans = to;
    num++;
  }
  cout << ans << ' ' << num << endl;
}
