#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:36777216")
using namespace std;
int main(void) {
  int a[106];
  int n, m;
  scanf("%d%d", &n, &m);
  for (int i = 0; i < n; i++) scanf("%d", &a[i]);
  sort(a, a + n, greater<int>());
  int ans;
  for (ans = 1; ans <= n; ans++) {
    m -= a[ans - 1];
    ;
    if (m <= 0) break;
  }
  cout << ans << endl;
  return 0;
}
