#include <bits/stdc++.h>
using namespace std;
bool used[50];
int n;
int ss[500001], v[50];
int main(void) {
  int d;
  int i, ans = 0, sum = 0, j;
  scanf("%d%d", &n, &d);
  for (i = 0; i < n; i++) {
    scanf("%d", &v[i]);
    sum += v[i];
  }
  ss[0] = true;
  for (i = 0; i < n; i++)
    for (j = sum; j >= v[i]; j--)
      if (ss[j - v[i]]) ss[j] = true;
  int curr = 0, next = 0;
  while (curr < sum) {
    for (i = curr + 1; i <= min(sum, curr + d); i++)
      if (ss[i]) next = i;
    if (curr == next) break;
    ans++;
    curr = next;
  }
  printf("%d %d\n", curr, ans);
}
