#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:102400000,102400000")
using namespace std;
const int M = 1e6 + 5, INF = 0x3f3f3f3f, mod = 1e9 + 7;
const int N = 1e6 + 5;
int A[M];
int dp[M];
int main() {
  int n, m;
  scanf("%d%d", &n, &m);
  dp[0] = 1;
  for (int j = 1; j <= n; j++) {
    int a;
    scanf("%d", &a);
    for (int k = M - 5; k >= a; k--) dp[k] |= dp[k - a];
  }
  int a = 0, b = 0;
  while (1) {
    int now = a;
    for (int j = a; j <= a + m; j++) {
      if (dp[j]) {
        now = j;
      }
    }
    if (now == a) break;
    a = now;
    b++;
  }
  printf("%d %d\n", a, b);
  return 0;
}
