#include <bits/stdc++.h>
using namespace std;
int drive[100005];
int main(void) {
  int n, m;
  while (scanf("%d %d", &n, &m) != EOF) {
    for (int i = 0; i < n; i++) {
      scanf("%d", &drive[i]);
    }
    sort(drive, drive + n, greater<int>());
    int res = 0, i = 0;
    while (res < m) {
      res += drive[i];
      i += 1;
    }
    printf("%d\n", i);
  }
  return 0;
}
