#include <bits/stdc++.h>
using namespace std;
int dp[600000], tree[3000000], ara[600000], big = 25000000;
vector<int> vc;
void build(int node, int st, int en) {
  tree[node] = big;
  if (st == en) return;
  int mid = (st + en) / 2;
  build(node * 2, st, mid);
  build(node * 2 + 1, mid + 1, en);
}
void update(int node, int st, int en, int i, int val) {
  if (st > i or en < i) return;
  if (st == en) {
    tree[node] = val;
    return;
  }
  int mid = (st + en) / 2;
  update(node * 2, st, mid, i, val);
  update(node * 2 + 1, mid + 1, en, i, val);
  tree[node] = min(tree[node * 2], tree[node * 2 + 1]);
}
int query(int node, int st, int en, int l, int r) {
  if (st > r or en < l) return big;
  if (st >= l and en <= r) {
    return tree[node];
  }
  int mid = (st + en) / 2;
  int p = query(node * 2, st, mid, l, r);
  int q = query(node * 2 + 1, mid + 1, en, l, r);
  return min(p, q);
}
int bin(int id, int d) {
  int l = 0, k = id, mid, ans = id, val = vc[id];
  while (l <= k) {
    mid = (l + k) / 2;
    if (vc[mid] + d >= val) {
      ans = mid;
      k = mid - 1;
    } else
      l = mid + 1;
  }
  return ans;
}
int main() {
  int i, j, k, l, m, n, d, sum = 0;
  scanf("%d%d", &n, &d);
  for (int i = 1; i <= n; i++) {
    cin >> ara[i];
    sum += ara[i];
  }
  dp[0] = 1;
  for (int i = 1; i <= n; i++) {
    for (int j = sum; j >= ara[i]; j--) {
      dp[j] |= dp[j - ara[i]];
    }
  }
  for (int i = 0; i <= sum; i++) {
    if (dp[i]) vc.push_back(i);
  }
  build(1, 0, vc.size() - 1);
  update(1, 0, vc.size() - 1, 0, 0);
  dp[0] = 0;
  for (int i = 1; i < vc.size(); i++) {
    l = bin(i, d);
    dp[i] = query(1, 0, vc.size() - 1, l, i) + 1;
    update(1, 0, vc.size() - 1, i, dp[i]);
  }
  for (int i = vc.size() - 1; i >= 0; i--) {
    if (dp[i] >= big) continue;
    cout << vc[i] << " " << dp[i] << endl;
    break;
  }
}
