显示代码纯文本
		
		#include <fstream>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <functional>
using namespace std;
ifstream fi ("shelf.in");
ofstream fo ("shelf.out");
int h,n,high=0;
long long b;
int H[20002]={0};
/*void work(int high,int p,int q)
{
	if(high>=b)
	{
		if (p<ans)ans=p;
		return;
	}
	for (int j=q;j<n;j++)
		work(high+H[j],p+1,j+1);
}*/
int main()
{
	fi>>n>>b;
	for (int i=0;i<n;i++)
		fi>>H[i];
	sort(H,H+n,greater<int>());
	//work(0,0,0);
	//for (int i=0;i<n;i++)fo<<H[i]<<" ";
	//fo<<endl;
	for (int i=0;i<n;i++)
	{
		high+=H[i];
		if (high>=b)
		{
			fo<<i+1<<endl;
			return 0;
		}
	}
    return 0;
}