#include <bits/stdc++.h>
using namespace std;
int main() {
  int N, x;
  cin >> N >> x;
  int child[N];
  for (int i = 0; i < N; i++) cin >> child[i];
  sort(child, child + N);
  int count = 0;
  int time = 1;
  while (x > 0) {
    for (int i = 0; i < N; i++) {
      x -= child[i];
      if (x < 0) break;
      if (time > 1) {
        count--;
      } else {
        count++;
      }
    }
    time++;
  }
  cout << count << endl;
}
