#include <bits/stdc++.h>
int main(void) {
  int max[114514114514], count[114514114514];
  int i, j, n, x, y, 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[i] > count[j]) {
        int d = count[i];
        count[i] = count[j];
        count[j] = d;
      }
    }
  }
  for (i = 0; i < n; i++) {
    max[i] = count[i];
  }
  for (ans = 0, y = 0; max[i - 1] < x, y <= i; y++) {
    if (max[y] < x) {
      x -= max[y];
      ans += 1;
    }
  }
  printf("%d", ans);
  return 0;
}
