#include <bits/stdc++.h>
using namespace std;
const unsigned long long P = 239017, MaxN = 2100000, INF = 1000000000;
int n, d, can[510100], a[1000];
vector<int> q;
int main() {
  scanf("%d%d", &n, &d);
  for (int i = 0; i < n; ++i) scanf("%d", &a[i]);
  can[0] = 1;
  for (int i = 0; i < n; ++i) {
    for (int have = 500000; have >= 0; --have)
      if (can[have]) can[have + a[i]] = 1;
  }
  for (int i = 0; i <= 500000; ++i)
    if (can[i]) q.push_back(i);
  int day = 0, now = 0;
  for (int i = 0; i < q.size(); ++i) {
    if (now + d < q[i]) {
      if (now + d >= q[i - 1]) now = q[i - 1], ++day;
    }
  }
  if (now + d >= q.back()) now = q.back(), ++day;
  printf("%d %d\n", now, now == 0 ? 0 : day);
  return 0;
}
