#include <bits/stdc++.h>
int dp[3][500010], n, a[101], maxsum, d, ans, cnt, tot, can[500010];
int main() {
  scanf("%d%d", &n, &d);
  maxsum = 0;
  for (int i = 1; i <= n; i++) {
    scanf("%d", &a[i]);
    maxsum += a[i];
  }
  std::sort(a + 1, a + n + 1);
  memset(dp, 0, sizeof dp);
  dp[0][0] = 1;
  for (int i = 0; i < n; i++)
    for (int j = 0; j <= maxsum; j++) {
      if (!dp[i & 1][j]) continue;
      dp[(i + 1) & 1][j] = 1;
      dp[(i + 1) & 1][j + a[i + 1]] = 1;
    }
  tot = 0;
  for (int i = 1; i <= maxsum; i++)
    if (dp[n & 1][i]) can[++tot] = i;
  int tmp = 0;
  while (tmp < tot) {
    while (tmp + 1 <= tot && can[tmp + 1] <= ans + d) tmp++;
    if (can[tmp] <= ans) break;
    cnt++;
    ans = can[tmp];
  }
  printf("%d %d\n", ans, cnt);
  return 0;
}
