#include <algorithm>
#include <iostream>
using namespace std;

const int MaxN = 2e4 + 5;
int N, B, H[MaxN], ans, num;

int main() {
  cin >> N >> B;
  for (int i = 1; i <= N; i++) {
    cin >> H[i];
  }

  sort(H + 1, H + 1 + N, [](int a, int b) { return a > b; });

  do {
    num++;
    ans += H[num];
  } while (ans < B);

  cout<<num<<endl;
}