#include <bits/stdc++.h>
int main() {
  int n, m, temp = 0, f = 0, p = 1;
  scanf("%d%d", &n, &m);
  int a[n];
  for (int i = 0; i < n; i++) {
    scanf("%d", &a[i]);
    if (a[i] >= m) {
      f = 1;
    }
  }
  if (f == 1) {
    printf("1");
  } else {
    for (int i = n; i >= 0; i--) {
      for (int j = 0; j < i - 1; j++) {
        if (a[j] < a[j + 1]) {
          temp = a[j];
          a[j] = a[j + 1];
          a[j + 1] = temp;
        }
      }
    }
    int sum = a[0];
    for (int i = 1; i < n; i++) {
      if (sum < m) {
        p++;
        sum = sum + a[i];
      }
    }
    printf("%d\n", p);
  }
  return 0;
}
