#include <bits/stdc++.h>
using namespace std;
inline char nc() {
  static char buf[1 << 21], *p1 = buf, *p2 = buf;
  return p1 == p2 && (p2 = (p1 = buf) + fread(buf, 1, 1 << 21, stdin), p1 == p2)
             ? EOF
             : *p1++;
}
inline int read() {
  int x = 0, f = 1;
  char c = nc();
  while (c < '0' || c > '9') {
    if (c == '-') f = -1;
    c = nc();
  }
  while (c >= '0' && c <= '9') x = (x << 3) + (x << 1) + (c ^ '0'), c = nc();
  return x * f;
}
const int N = 5.1e5 + 5;
int n, d, c[N];
int ans, last;
int f[N];
inline int check() {
  last = ans;
  for (int i = last + d; i >= last; --i) {
    if (f[i]) {
      ans = i;
      break;
    }
  }
  return ans == last;
}
int main() {
  n = read(), d = read();
  int s = 0;
  s += d;
  f[0] = 1;
  for (int i = 1; i <= n; i++) {
    int x = read();
    s += x;
    for (int j = s; j >= x; j--) f[j] |= f[j - x];
  }
  int t = 0;
  while (++t)
    if (check()) return printf("%d %d\n", ans, t - 1), 0;
  return 0;
}
