#include <bits/stdc++.h>
using namespace std;
const int sz = 112345;
int a[100];
bool dp[52][500005];
int sums[500005];
int main() {
  int n, d, i, j, ans, day;
  scanf("%d", &n);
  scanf("%d", &d);
  for (i = 0; i < n; i++) {
    scanf("%d", &a[i]);
  }
  for (i = 0; i < 500005; i++) dp[0][i] = 0;
  dp[0][0] = 1;
  for (i = 1; i <= n; i++) {
    dp[i][0] = 1;
    for (j = 1; j < 500005; j++) {
      dp[i][j] = dp[i - 1][j];
      if (a[i - 1] <= j) dp[i][j] |= dp[i - 1][j - a[i - 1]];
    }
  }
  j = 0;
  for (i = 0; i < 500005; i++)
    if (dp[n][i]) {
      sums[j] = i;
      j++;
    }
  ans = 0;
  day = 0;
  for (i = 1; i < j; i++) {
    if (sums[i] > sums[i - 1] + d) break;
    int k = i;
    while (k < j && sums[k] <= sums[i - 1] + d) k++;
    k--;
    ans = sums[k];
    i = k;
    day++;
  }
  printf("%d %d\n", ans, day);
  return 0;
}
