#include <bits/stdc++.h>
using namespace std;
int dp[550000];
int main() {
  int n, d;
  int i, j;
  while (scanf("%d %d", &n, &d) != EOF) {
    int x;
    memset(dp, 0, sizeof(dp));
    for (i = 0; i < n; i++) {
      scanf("%d", &x);
      for (j = 550000; j >= x; j--) dp[j] = max(dp[j - x] + x, dp[j]);
    }
    int ans = 0, day = 0;
    while (ans <= 550000) {
      if (dp[ans + d] > ans) {
        ans = dp[ans + d];
        day++;
      } else
        break;
    }
    printf("%d %d\n", ans, day);
  }
  return 0;
}
