#include <bits/stdc++.h>
using namespace std;
int n, m, sum;
bool f[520000];
int main() {
  scanf("%d%d", &n, &m);
  f[0] = true;
  for (int i = 0; i < n; i++) {
    int x;
    scanf("%d", &x);
    sum += x;
    for (int j = sum; j >= x; j--) {
      f[j] |= f[j - x];
    }
  }
  int ans = 0, tot = 0;
  while (true) {
    int pre_ans = ans;
    ans += m;
    for (; !f[ans]; ans--)
      ;
    if (ans == pre_ans) {
      break;
    }
    tot++;
  }
  printf("%d %d\n", ans, tot);
  return 0;
}
