#include <bits/stdc++.h>
using namespace std;
int main() {
  int N, x;
  cin >> N >> x;
  vector<int> vec(N);
  for (int i = 0; i < N; i++) {
    cin >> vec.at(i);
  }
  sort(vec.begin(), vec.end());
  int vecSum = 0;
  int count = 0;
  int residue = x;
  for (int i = 0; i < N; i++) {
    vecSum += vec.at(i);
  }
  cout << vecSum << endl;
  if (vecSum == x) {
    cout << N << endl;
    return 0;
  } else {
    for (int i = 0; i < N; i++) {
      if (residue >= vec.at(i)) {
        residue -= vec.at(i);
        count++;
      }
    }
    if (count == N) {
      cout << N - 1 << endl;
      return 0;
    } else {
      cout << count << endl;
      return 0;
    }
  }
}
