#include <bits/stdc++.h>
using namespace std;
int n, d, h[1000000], ans = 0, a[1000000];
int main() {
  scanf("%d%d", &n, &d);
  memset(h, 0, sizeof(h));
  h[0] = 1;
  int sum = 0;
  for (int i = 1; i <= n; i++) {
    scanf("%d", &a[i]);
    for (int j = sum; j >= 0; j--)
      if (h[j]) h[j + a[i]] = 1;
    sum += a[i];
  }
  int cur = 0;
  int pos = 1;
  while (pos) {
    pos = 0;
    for (int i = cur + d; i >= cur + 1; i--)
      if (h[i]) {
        cur = i;
        ans++;
        pos = 1;
      }
  }
  cout << cur << " " << ans << endl;
  return 0;
}
