// Problem: P2676 [USACO07DEC]Bookshelf B
// Contest: Luogu
// URL: https://www.luogu.com.cn/problem/P2676
// Memory Limit: 125 MB
// Time Limit: 1000 ms
// User: Pannnn
#include <bits/stdc++.h>
using namespace std;
int main() {
ios::sync_with_stdio(false);
cin.tie(0);
long long n, b;
cin >> n >> b;
vector<int> info(n);
for (int i = 0; i < n; ++i) {
cin >> info[i];
}
sort(info.begin(), info.end(), greater<int>());
long long res = 0;
for (int i = 0; i < n && res < b; ++i) {
res += info[i];
if (res >= b) {
cout << i + 1 << endl;
}
}
return 0;
}