#include <bits/stdc++.h>
using namespace std;
int a[1001];
int main() {
  int n, m;
  cin >> n >> m;
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
  }
  sort(a + 1, a + n + 1);
  for (int i = n; i >= 1; i--) {
    m -= a[i];
    if (m <= 0) {
      cout << n + 1 - i << endl;
      return 0;
    }
  }
  return 0;
}
