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