#include <bits/stdc++.h>
using namespace std;
const int maxn = 5e5 + 10;
const int MOD = 1e9 + 7;
int dp[52][maxn];
int c[52];
void calc(int n, int maxW) {
  for (int i = 1; i <= n; ++i) {
    for (int w = 0; w < c[i - 1]; ++w) dp[i][w] = dp[i - 1][w];
    for (int w = c[i - 1]; w <= maxW; ++w)
      dp[i][w] = max(dp[i - 1][w - c[i - 1]] + c[i - 1], dp[i - 1][w]);
  }
}
int main() {
  int n, d;
  scanf("%d %d", &n, &d);
  for (int i = 0; i < n; ++i) scanf("%d ", &(c[i]));
  int maxW = accumulate(c, c + n, 0);
  calc(n, maxW);
  int ans = 0, days = 0;
  while (1) {
    int max_cost = min(ans + d, maxW);
    int new_ans = dp[n][max_cost];
    if (ans == new_ans) break;
    ans = new_ans;
    days++;
  }
  cout << ans << " " << days << endl;
  return 0;
}
