#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  long long x;
  cin >> n >> x;
  vector<long long> a(n);
  for (int i = 0; i < (n); ++i) cin >> a[i];
  sort(a.begin(), a.end());
  long long res = 0;
  for (int i = 0; i < (n); ++i) {
    if (x >= a[i]) {
      x -= a[i];
      res++;
    }
  }
  if (x > 0) {
    if (res == 0) cout << res << endl;
  } else {
    cout << res - 1 << endl;
  }
  cout << res << endl;
  return 0;
}
