#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 sum = a[0];
  int index = 0;
  while (sum < x) {
    sum += a[index];
    index++;
  }
  cout << index << endl;
}
