???????????? ????????????,?????????:)
????????????
?????????????????????
????????????
??????,????????????????????????????????????
????????????
#include <bits/stdc++.h>
#define ll long long
using namespace std;
const int M =1e5;
int f[M+10],a[1000+10],n,m;
int main()
{
ios::sync_with_stdio(0),cin.tie(0);
#ifdef LOCAL_DEFINE
freopen("rush.txt","r",stdin);
#endif // LOCAL_DEFINE
cin >> n >> m;
for (int i = 1;i <= n;i++) cin >> a[i];
sort(a+1,a+1+n);
reverse(a+1,a+1+n);
int cnt = 0;
for (int i = 1;i <= n && m>0;i++){
m-=a[i];
cnt++;
}
cout <<cnt<<endl;
return 0;
}