#include <bits/stdc++.h>
using namespace std;
bool vis[6000000];
int main() {
  int n, d, c, ans, cnt, sum;
  while (cin >> n >> d) {
    memset(vis, false, sizeof(vis));
    sum = 0;
    vis[0] = true;
    for (int i = 0; i < n; i++) {
      cin >> c;
      sum += c;
      for (int j = sum; j >= c; j--) {
        vis[j] |= vis[j - c];
      }
    }
    ans = cnt = 0;
    for (;; cnt++) {
      int i = d;
      for (; i > 0; i--) {
        if (vis[ans + i]) {
          ans += i;
          break;
        }
      }
      if (!i) break;
    }
    cout << ans << " " << cnt << endl;
  }
}
