#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, x;
  cin >> n >> x;
  priority_queue<int> q;
  while (n--) {
    int t;
    cin >> t;
    q.push(-t);
  }
  q.push(-x - 1);
  int res = 0;
  while ((x += q.top()) >= 0) {
    q.pop();
    res++;
  }
  cout << res << endl;
}
