#include <bits/stdc++.h>
using namespace std;
const int maxn = 511111;
int num[maxn];
int q[maxn];
int main() {
  int i, j, n, m, k;
  scanf("%d%d", &n, &m);
  memset(num, 0, sizeof(num));
  num[0] = 1;
  for (i = 1; i <= n; i++) {
    scanf("%d", &k);
    for (j = 500000; j >= k; j--) {
      if (num[j - k]) num[j] = 1;
    }
  }
  int tot = 0;
  for (i = 0; i <= 500000; i++)
    if (num[i]) q[++tot] = i;
  q[0] = 0;
  int tt = 0;
  int ans = 0;
  q[++tot] = 1111111111;
  for (i = 1; i <= tot;) {
    if (q[i] - ans <= m) {
      i++;
    } else {
      i--;
      if (ans == q[i]) break;
      ans = q[i];
      tt++;
    }
  }
  printf("%d %d\n", ans, tt);
  return 0;
}
