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