/*
Time:2019.12.2
Author: Goven
type:水题
err:
ref:
*/
#include<iostream>
#include<algorithm>
using namespace std;
int h[20005];
bool cmp(int x, int y) {
return x > y;
}
int main()
{
int n, b;
cin >> n >> b;
for (int i = 0; i < n; i++) {
cin >> h[i];
}
sort(h, h+n, cmp);
for (int i = 0; i < n; i++) {
b -= h[i];
if (b <= 0) {
cout << i + 1 << endl;
break;
}
}
return 0;
}
网友评论