#include <bits/stdc++.h>
using namespace std;
bool dp[1000005];
int n, d;
int main() {
  int i, j, ans = 0, a;
  scanf("%d%d", &n, &d);
  memset(dp, 0, sizeof(dp));
  dp[0] = 1;
  for (i = 0; i < n; i++) {
    scanf("%d", &a);
    for (j = 1000000; j >= a; j--)
      if (dp[j - a] == 1) dp[j] = 1;
  }
  int temp = 0;
  while (1) {
    bool flag = 0;
    for (i = temp + d; i > temp; i--)
      if (dp[i]) {
        flag = 1;
        break;
      }
    if (!flag) break;
    ans++;
    temp = i;
  }
  printf("%d %d\n", temp, ans);
  return 0;
}
