#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, greater<int>());
  int peop = 0;
  for (int i = 0; i < N || x < a[i]; ++i) {
    x -= a[i];
    ++peop;
  }
  cout << peop << endl;
}
