#include <bits/stdc++.h>
int c[50], n;
bool vis[50][500001], possible[511111];
void find(int i, int sum) {
  if (i == n) {
    possible[sum] = 1;
    return;
  }
  if (vis[i][sum]) return;
  vis[i][sum] = 1;
  find(i + 1, sum);
  find(i + 1, sum + c[i]);
}
int main() {
  int d;
  scanf("%d%d", &n, &d);
  for (int i = 0; i < n; i++) scanf("%d", c + i);
  find(0, 0);
  int sum = 0, days = 0;
  while (1) {
    bool moveUp = 0;
    for (int diff = d; diff > 0; diff--) {
      if (possible[sum + diff]) {
        moveUp = 1;
        sum += diff;
        break;
      }
    }
    if (!moveUp) {
      printf("%d %d\n", sum, days);
      break;
    }
    days++;
  }
  return 0;
}
