#include <bits/stdc++.h>
using namespace std;
const int MAXN = 500010;
bool vis[MAXN] = {0};
int M[MAXN];
int N, K, T;
int main() {
  cin >> N >> K;
  vis[0] = true;
  for (int i = 1; i <= N; i++) {
    cin >> T;
    for (int j = i * 10000; j >= 0; j--)
      if (vis[j]) vis[j + T] = true;
  }
  int all = 0;
  for (int i = 0; i < MAXN; i++)
    if (vis[i]) M[all++] = i;
  int ans = 0;
  int now = 0;
  while (1) {
    int p = now + K;
    int po = upper_bound(M, M + all, p) - M - 1;
    if (M[po] == now) break;
    now = M[po];
    ans++;
  }
  printf("%d %d\n", now, ans);
}
