#include <bits/stdc++.h>
using namespace std;
#pragma warning(disable : 4996)
#pragma comment(linker, "/STACK:16777216")
#pragma warning(disable : 4996)
#pragma comment(linker, "/STACK:16777216")
#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma")
const int inf = 2000000000;
const long long linf = 5000000000000000000;
const long double LDINF = 2e18;
template <typename T>
void print(vector<T>& a) {
  for (int i = 0; i < a.size(); i++) cout << a[i] << ' ';
  cout << '\n';
}
template <typename T>
void print(deque<T>& a) {
  for (int i = 0; i < a.size(); i++) cout << a[i] << ' ';
  cout << '\n';
}
template <typename T>
void print(vector<vector<T>>& a) {
  for (int i = 0; i < a.size(); i++) {
    for (int j = 0; j < a[i].size(); j++) cout << a[i][j] << ' ';
    cout << '\n';
  }
}
template <typename T>
void input(vector<T>& a) {
  for (int i = 0; i < a.size(); i++) cin >> a[i];
}
template <typename T>
void input(deque<T>& a) {
  for (int i = 0; i < a.size(); i++) cin >> a[i];
}
template <typename T>
void input(vector<vector<T>>& a) {
  for (int i = 0; i < a.size(); i++)
    for (int j = 0; j < a[i].size(); j++) cin >> a[i][j];
}
long long mod = 1e9 + 7;
long long gcd(long long a, long long b) {
  if (b == 0)
    return a;
  else
    return gcd(b, a % b);
}
vector<int> t, tAdd;
void push(int v, int vl, int vr) {
  if (tAdd[v] == 0) return;
  t[v] += tAdd[v];
  if (vl != vr) {
    tAdd[2 * v + 1] += tAdd[v];
    tAdd[2 * v + 2] += tAdd[v];
  }
  tAdd[v] = 0;
}
long long query(int v, int vl, int vr, int l, int r) {
  push(v, vl, vr);
  if (vl >= l && vr <= r)
    return t[v];
  else if (vl > r || l > vr)
    return 0;
  int vm = (vl + vr) / 2;
  return query(2 * v + 1, vl, vm, l, r) + query(2 * v + 2, vm + 1, vr, l, r);
}
void modify(int v, int vl, int vr, int l, int r, int val) {
  push(v, vl, vr);
  if (vl >= l && vr <= r) {
    tAdd[v] += val;
    push(v, vl, vr);
    return;
  }
  if (vl > r || l > vr) return;
  int vm = (vl + vr) / 2;
  modify(2 * v + 1, vl, vm, l, r, val);
  modify(2 * v + 2, vm + 1, vr, l, r, val);
  t[v] = t[2 * v + 1] + t[2 * v + 2];
}
int n, k, cnt = 0;
void check(string& str) {
  vector<bool> used(k + 1, false);
  for (int i = 0; i < str.length(); i++) used[str[i] - '0'] = true;
  for (int i = 0; i < k + 1; i++) {
    if (!used[i]) return;
  }
  cnt++;
}
void solve() {
  long long n, d;
  cin >> n >> d;
  vector<long long> c(n);
  input(c);
  long long sum = 0;
  for (int i = 0; i < n; i++) {
    sum += c[i];
  }
  vector<vector<bool>> dp(n + 1, vector<bool>(sum + 1, false));
  dp[0][0] = true;
  for (int i = 0; i < n; i++) {
    for (int w = 0; w <= sum; w++) {
      if (dp[i][w]) dp[i + 1][w + c[i]] = true;
      if (dp[i][w]) dp[i + 1][w] = true;
    }
  }
  vector<int> vals;
  for (int w = 0; w <= sum; w++) {
    for (int i = 0; i <= n; i++) {
      if (dp[i][w]) {
        vals.push_back(w);
        break;
      }
    }
  }
  long long now = 0;
  int cnt = 0;
  while (true) {
    auto it = upper_bound((vals).begin(), (vals).end(), now + d);
    it--;
    if (*it == now) break;
    now = *it;
    cnt++;
  }
  cout << now << ' ' << cnt;
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int tst = 1;
  while (tst--) solve();
}
