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