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