#include<iostream>
#include<bits/stdc++.h>
using namespace std;

main(){
  int n,x,i;
  cin >> n >> x;
  int a[n];
  for (i=1;i<=n;i++){
    cin >> a[i];
  }
  sort(a.begin(),a.end());
  for (i=1;x<=0;i++){
    x-=a[i];
  }
  cout << i << endl;
}