#include <bits/stdc++.h>
using namespace std;
int number_of_usb;
int file_size;
int usb_required = 0;
int summing = 0;
int temp;
int main() {
  cin >> number_of_usb;
  cin >> file_size;
  int usb_sizes[number_of_usb];
  for (int i = 0; i < number_of_usb; i++) {
    cin >> usb_sizes[i];
  }
  for (int i = 0; i < number_of_usb; i++) {
    for (int j = 0; j < number_of_usb; j++) {
      if (usb_sizes[i] > usb_sizes[j]) {
        temp = usb_sizes[j];
        usb_sizes[j] = usb_sizes[i];
        usb_sizes[i] = temp;
      }
    }
  }
  for (int i = 0; i < number_of_usb; i++) {
    if (summing < file_size) {
      usb_required++;
    }
    summing += usb_sizes[i];
  }
  cout << usb_required;
  return 0;
}
