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