#include <bits/stdc++.h>
using namespace std;
int DEBUG = 0;
int isatt[2][600000];
int ispurable[600000];
int steps[600000];
int main(int argc, char **argv) {
  DEBUG = (argc >= 2) ? atoi(argv[1]) : 0;
  int n, d;
  cin >> n >> d;
  int c[n];
  for (int i = 0; i < n; i++) cin >> c[i];
  for (int i = 0; i < 2; i++) {
    for (int j = 0; j < 600000; j++) {
      isatt[i][j] = 0;
    }
  }
  isatt[1][0] = 1;
  isatt[0][0] = 1;
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < 600000; j++) isatt[i % 2][j] = 0;
    for (int j = 0; j < 600000; j++) {
      if (isatt[(i + 1) % 2][j] == 1) {
        isatt[i % 2][j] = 1;
        isatt[i % 2][j + c[i]] = 1;
      }
    }
  }
  for (int i = 0; i < 600000; i++) {
    steps[i] = 0;
    ispurable[i] = 0;
  }
  int troll = (n + 1) % 2;
  ispurable[0] = 1;
  int tmp = 0;
  int tt = 0;
  while (tmp < 600000) {
    int cmax = -1;
    tt++;
    for (int i = 1; i <= d; i++) {
      if (isatt[troll][tmp + i] == 1) {
        ispurable[tmp + i] = 1;
        cmax = max(cmax, tmp + i);
        steps[tmp + i] = tt;
      }
    }
    if (cmax == -1) {
      break;
    }
    tmp = cmax;
  }
  for (int i = 600000 - 1; i >= 0; i--) {
    if (ispurable[i] == 1) {
      cout << i << ' ' << steps[i] << endl;
      return 0;
    }
  }
  return 0;
}
