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