#include <iostream>
#include <algorithm>
#define int long long
using namespace std;
int n, h[10001], b, height;
signed main()
{
cin >> n >> b;
for (int i = 0;i < n;i ++)
cin >> h[i];
sort(h, h+n, greater<int>());
int cnt = 0;
height = 0;
for (int i = 0;i < n;i ++)
{
cnt ++;
height += h[i];
if (height >= b) break;
}
cout << cnt;
}