#include <bits/stdc++.h>
int main() {
  int n, s;
  scanf("%d %d", &n, &s);
  int arr[n];
  int i, j, temp;
  for (i = 0; i < n; i++) {
    scanf("%d", &arr[i]);
  }
  for (i = 0; i < n - 1; i++) {
    for (j = 0; j < n - i - 1; j++) {
      if (arr[j] < arr[j + 1]) {
        temp = arr[j];
        arr[j] = arr[j + 1];
        arr[j + 1] = temp;
      }
    }
  }
  int count = 0, f = 0, k = 0;
  while (f < s) {
    f = f + arr[k];
    count = count + 1;
    k++;
  }
  printf("%d", count);
}
