#include <bits/stdc++.h>
const int MAXN = 55, MAX = 6e5 + 10, littleMAX = 5e5 + 10;
using namespace std;
int n, d, last, ant, cnt;
int c[MAXN];
bool dp[MAX];
int main() {
  scanf("%d%d", &n, &d);
  for (int i = 1; i < n + 1; i++) scanf("%d", &c[i]);
  dp[0] = true;
  for (int i = 1; i < n + 1; i++)
    for (int j = littleMAX - c[i]; j >= 0; j--) dp[j + c[i]] |= dp[j];
  while (true) {
    int bef = ant;
    for (int i = ant + d; i > last; i--)
      if (dp[i]) {
        last = ant + d;
        ant = i;
        break;
      }
    cnt++;
    if (ant == bef) break;
  }
  printf("%d %d\n", ant, cnt - 1);
}
