#include <bits/stdc++.h>
using namespace std;
int nums[10100], f[551000], n, d;
int main() {
  scanf("%d%d", &n, &d);
  for (int i = 1; i <= n; ++i) scanf("%d", &nums[i]);
  f[0] = 1;
  for (int i = 1; i <= n; ++i)
    for (int j = 551000; j >= nums[i]; --j)
      if (f[j - nums[i]]) f[j] = 1;
  int things_now = 0, time = 0;
  for (; time <= 551000; ++time) {
    int best = things_now + d;
    for (int r = best; r >= things_now; --r) {
      if (f[r] == 1) {
        things_now = r;
        break;
      }
    }
    if (best == things_now + d) break;
  }
  printf("%d %d\n", things_now, time);
  return 0;
}
