#include <bits/stdc++.h>
using namespace std;
int a[110];
void solve() {
  int n, m;
  scanf("%d%d", &n, &m);
  for (int i = 1; i <= n; i++) scanf("%d", &a[i]);
  sort(a + 1, a + n + 1);
  int cnt = 0, sum = 0;
  for (int i = n; i >= 1; i--) {
    cnt++;
    sum += a[i];
    if (sum >= m) {
      printf("%d", cnt);
      break;
    }
  }
}
int main() {
  solve();
  return 0;
}
