#include <bits/stdc++.h>
using namespace std;
int n, m, sum = 0, j = 0, i, a[101];
int main() {
  cin >> n >> m;
  for (i = 0; i < n; i++) cin >> a[i];
  sort(a, a + n);
  reverse(a, a + n);
  for (i = 0; i < n && sum < m; i++) {
    sum += a[i];
    j++;
  }
  cout << j << endl;
}
