#include <bits/stdc++.h>
using namespace ::std;
int n1, m1;
int a1[105];
int d[500005];
int la[500005];
priority_queue<pair<int, int> > q;
int main() {
  int i, j;
  scanf("%d %d", &n1, &m1);
  for (i = 1; i <= n1; i++) scanf("%d", &a1[i]);
  d[0] = 1;
  for (i = 1; i <= n1; i++) {
    for (j = 500000; j >= a1[i]; j--)
      if (d[j - a1[i]] == 1) d[j] = 1;
  }
  q.push(make_pair(0, 0));
  for (i = 1; i <= 500000; i++) {
    if (d[i] == 1) {
      while (!q.empty()) {
        if (i - q.top().second > m1)
          q.pop();
        else
          break;
      }
      if (!q.empty()) {
        la[i] = q.top().first - 1;
        q.push(make_pair(la[i], i));
      }
    }
  }
  for (i = 500000; i >= 1; i--) {
    if (la[i] != 0) {
      printf("%d %d", i, -la[i]);
      break;
    }
  }
  if (i == 0) printf("0 0");
  return 0;
}
