#include <bits/stdc++.h>
int main(void) {
  int max[114514], count[114514];
  int i, j, n, x, ans;
  scanf("%d%d", i, x);
  for (n = 0; n < 114514; n++) {
    int a;
    scanf("%d", &a);
    count[n] = a;
  }
  for (i = 0; i < n - 1; i++) {
    for (j = n - 1; j > i; j--) {
      if (count[j - 1] < count[j]) {
        int d = count[j - 1];
        count[j - 1] = count[j];
        count[j] = d;
      }
    }
  }
  for (i = 0; i < n; i++) {
    max[i] = count[i];
  }
  for (ans = 0, i = 0; max[i - 1] < x; i--) {
    if (max[i - 1] < x) {
      x -= max[i - 1];
      ans += 1;
    }
  }
  printf("%d", ans);
  return 0;
}
