#include <bits/stdc++.h>
using namespace std;
int n, d, c[51], la, Max;
bool f[600005];
int find(int l, int r) {
  for (int i = r; i >= l; i--)
    if (f[i]) return i;
  return l;
}
int main() {
  scanf("%d%d", &n, &d);
  for (int i = 1; i <= n; i++) scanf("%d", &c[i]);
  f[0] = 1;
  for (int i = 1; i <= n; i++)
    for (int j = 600005 - 5; j >= c[i]; j--)
      if (f[j - c[i]]) f[j] = 1;
  for (int i = 1;; i++) {
    la = Max;
    Max = find(Max, d + la);
    if (la != Max) continue;
    printf("%d %d\n", Max, i - 1);
    return 0;
  }
}
