#include <bits/stdc++.h>
using namespace std;
int dp[20000006], n, d, c[55], sum, j, now, day = -1;
int main() {
  cin >> n >> d;
  dp[0] = 1;
  for (int i = 1; i <= n; i++) {
    cin >> c[i];
    sum += c[i];
    for (j = sum; j >= c[i]; j--)
      if (dp[j - c[i]] == 1) dp[j] = dp[j - c[i]];
  }
  while (1) {
    day++;
    j = now + d;
    while (dp[j] == 0 && j > now) j--;
    if (j == now) break;
    now = j;
  }
  cout << j << " " << day << endl;
}
