#include <bits/stdc++.h>
using namespace std;
typedef struct node {
  int index;
  int value;
} Node;
vector<Node> ans;
vector<Node> arr;
int n, d;
int dp[6 * 100005];
int main() {
  while (scanf("%d%d", &n, &d) == 2) {
    int sum = 0;
    dp[0] = 1;
    for (int i = 0; i < n; i++) {
      int x;
      cin >> x;
      sum += x;
      for (int j = sum; j >= x; j--) {
        if (dp[j - x]) dp[j] = 1;
      }
    }
    int w = 0, days = 0;
    while (true) {
      int j = w + d;
      while (!dp[j] && j > w) j--;
      if (j == w) break;
      w = j;
      days++;
    }
    cout << w << " " << days << endl;
  }
  return 0;
}
