#include <bits/stdc++.h>
using namespace std;
priority_queue<int> q;
int n, b, h;
int main()
{
cin >> n >> b;
while (n--)
{
cin >> h;
q.push(h);
}
int ans = 0;
while (b > 0)
{
b -= q.top();
q.pop();
ans++;
}
cout << ans;
return 0;
}