#include <bits/stdc++.h>
using namespace std;
const int maxn = 2e6;
int a[maxn], dp[maxn];
int main() {
  int n, d;
  scanf("%d%d", &n, &d);
  for (int i = 1; i <= n; i++) scanf("%d", &a[i]);
  dp[0] = 1;
  for (int i = 1; i <= n; i++)
    for (int j = 600000; j >= a[i]; j--) dp[j] = max(dp[j], dp[j - a[i]]);
  int ans = 0, num = 0;
  while (1) {
    int flag = 0;
    for (int i = ans + d; i > ans; i--)
      if (dp[i]) {
        ans = i;
        num++;
        flag = 1;
      }
    if (!flag) break;
  }
  printf("%d %d", ans, num);
  return 0;
}
