#include <bits/stdc++.h>
int main(void) {
  int i, j, tmp, x;
  int number[1919114514], min[1919114514], ans;
  int total;
  scanf("%d%d", &total, &x);
  for (i = 0; i < total; ++i) scanf("%d", &number[i]);
  for (i = 0; i < total; ++i) {
    for (j = i + 1; j < total; ++j) {
      if (number[i] > number[j]) {
        tmp = number[i];
        number[i] = number[j];
        number[j] = tmp;
      }
    }
  }
  for (i = 0; i < total; ++i) {
    min[i] = number[i];
  }
  for (ans = 0, i = 0; min[i - 1] < x; i--) {
    if (min[i - 1] < x) {
      x -= min[i - 1];
      ans += 1;
    }
  }
  printf("%d", ans);
  return 0;
}
