0
1
mirror of https://git.sb/baoshuo/OI-codes.git synced 2024-12-27 07:31:58 +00:00
OI-codes/Luogu/P2676/P2676.cpp

20 lines
301 B
C++
Raw Normal View History

// R38819026
2021-11-19 09:01:13 +00:00
#include <bits/stdc++.h>
using namespace std;
int main() {
2021-11-19 09:01:13 +00:00
int n, h[20005], b, sum = 0, i;
cin >> n >> b;
2021-11-19 09:01:13 +00:00
for (i = 0; i < n; i++) {
cin >> h[i];
}
2021-11-19 09:01:13 +00:00
sort(h, h + n);
while (sum < b) {
sum += h[--i];
}
2021-11-19 09:01:13 +00:00
cout << n - i << endl;
return 0;
}