#include <bits/stdc++.h>
using namespace std;
int q[505050], f[505050], g[505050], a[505050];
int main() {
  int n, D;
  scanf("%d%d", &n, &D);
  for (int i = 1; i <= n; i++) scanf("%d", &a[i]);
  int m = 0;
  for (int i = 1; i <= n; i++) m += a[i];
  memset(g, 0, sizeof(g));
  g[0] = 1;
  for (int i = 1; i <= n; i++)
    for (int j = m; j >= a[i]; j--) g[j] |= g[j - a[i]];
  memset(f, 0x3f3f3f3f, sizeof(f));
  f[0] = 0;
  int l = 0, r = 0;
  q[r++] = 0;
  int ans = m;
  for (int i = 1; i <= m; i++) {
    if (!g[i]) continue;
    while (l < r && q[l] + D < i) l++;
    if (l == r) break;
    f[i] = f[q[l]] + 1;
    while (l < r && f[q[r]] >= f[i]) r--;
    q[r++] = i;
  }
  while (f[ans] == 0x3f3f3f3f) ans--;
  printf("%d %d\n", ans, f[ans]);
  return 0;
}
