#include <bits/stdc++.h>
using namespace std;
void file() {}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  file();
  int n, x;
  cin >> n >> x;
  vector<int> v(n);
  for (int i = 0; i < n; ++i) {
    cin >> v[i];
  }
  sort(v.begin(), v.end());
  int c = 0;
  for (int i = 0; i < n; ++i) {
    if (x - v[i] >= v[i]) {
      x = x - v[i];
      c++;
    }
  }
  cout << c << "\n";
}
