#include <bits/stdc++.h>
using namespace std;
int n, d;
int v[50 + 5];
bool F[5000000 + 5];
int main() {
  scanf("%d%d", &n, &d);
  for (int i = 1; i <= n; i++) scanf("%d", &v[i]);
  F[0] = true;
  int sum = 0;
  for (int i = 1; i <= n; i++) {
    sum += v[i];
    for (int j = sum; j >= v[i]; j--) F[j] |= F[j - v[i]];
  }
  int ans = 0, day = 0;
  bool found = false;
  while (1) {
    for (int i = d; i >= 1; i--) {
      if (F[ans + i]) {
        ans += i;
        day++;
        found = true;
        break;
      }
    }
    if (!found)
      break;
    else
      found = false;
  }
  printf("%d %d\n", ans, day);
  return 0;
}
