#include <bits/stdc++.h>
using namespace std;
int main() {
  int size, m, sum = 0, k = 0;
  cin >> size;
  vector<int> arr(size);
  cin >> m;
  for (int i = 0; i < size; i++) {
    cin >> arr[i];
  }
  sort(begin(arr), end(arr));
  for (int i = size - 1; i >= 0; i--) {
    m -= arr[i];
    k++;
    if (m <= 0) {
      break;
    }
  }
  cout << k;
}
