#include <bits/stdc++.h>
using namespace std;
const int MOD = 1e9 + 7;
int n, m, arr[105];
int main() {
  cin >> n >> m;
  for (int i = 0; i < n; ++i) cin >> arr[i];
  sort(arr, arr + n);
  int ans = 0, i = n - 1, sum = 0;
  while (sum < m) {
    sum += arr[i--];
    ans++;
    if (sum >= m) break;
  }
  cout << ans << endl;
  return 0;
}
