#include<cstdio>
#include<iostream>
#include<algorithm>
using namespace std;
int cmp(const int a,int b)
{ return (a>b);
}
int main()
{
freopen("shelf.in","r",stdin);
freopen("shelf.out","w",stdout);
int n,b,a[20002],ans=0,sum=0;
cin>>n>>b;
for (int i=1;i<=n;i++) cin>>a[i];
sort(a+1,a+n+1,cmp);
for (int i=1;i<=n;i++)
{ sum+=a[i];
ans++;
if (sum>=b) break;
}
cout<<ans;
return 0;
fclose(stdin); fclose(stdout);
}