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