#include <bits/stdc++.h>
using namespace std;
const int MAXN = 1e6 + 5;
int dp[MAXN];
int main() {
  int n, d, x;
  int cnt, sum, ans;
  cnt = sum = ans = 0;
  scanf("%d %d", &n, &d);
  dp[0] = 1;
  for (int i = 0; i < n; i++) {
    scanf("%d", &x);
    sum += x;
    for (int j = sum; j >= x; j--) {
      if (dp[j - x]) dp[j] = 1;
    }
  }
  while (1) {
    int t = ans + d;
    while (!dp[t] && t > ans) t--;
    if (t == ans) break;
    ans = t;
    cnt++;
  }
  printf("%d %d\n", ans, cnt);
  return 0;
}
