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

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