#include <bits/stdc++.h>
using namespace std;
int arr[50 + 5];
bool Sum[(int)1e4 * 50 + 5];
vector<int> vec;
int main() {
  int N, D, ans = 0, maxi = 0, tot = 0;
  scanf("%d %d", &N, &D);
  for (int i = 0; i < N; i++) {
    scanf("%d", &arr[i]);
    tot += arr[i];
  }
  Sum[0] = 1;
  for (int i = 0; i < N; i++) {
    for (int j = tot - arr[i]; j >= 0; j--)
      if (Sum[j] && !Sum[j + arr[i]]) {
        vec.push_back(j + arr[i]);
        Sum[j + arr[i]] = 1;
      }
  }
  sort(vec.begin(), vec.end());
  while (1) {
    int low = lower_bound(vec.begin(), vec.end(), maxi + D) - vec.begin();
    if (low == (int)vec.size() || vec[low] > maxi + D) low--;
    if (vec[low] <= maxi || vec[low] > maxi + D) break;
    maxi = vec[low];
    ans++;
  }
  printf("%d %d\n", maxi, ans);
  return 0;
}
