#include <bits/stdc++.h>
using namespace std;
int main() {
  long long m, n, j = 1, i, a[101], b, c, d, e, k = 0;
  string z;
  cin >> n >> m;
  for (i = 1; i <= n; i++) {
    cin >> a[i];
  }
  sort(a + 1, a + n + 1);
  for (i = n; i >= 1; i--) {
    if (m - a[i] > 0) {
      k++;
      m = m - a[i];
    } else {
      cout << k + 1;
      exit(0);
    }
  }
}
