#include <bits/stdc++.h>
using namespace std;
const int N = 107;
int a[N], x, n;
long long sum[N];
int main() {
  scanf("%d%d", &n, &x);
  for (int i = 1; i <= n; i++) scanf("%d", &a[i]);
  if (a[1] > x) {
    puts("0");
    return 0;
  }
  sort(a + 1, a + n + 1);
  for (int i = 1; i <= n; i++) {
    sum[i] = sum[i - 1] + a[i];
    if (sum[i] >= x) {
      cout << i << endl;
      return 0;
    }
  }
  cout << n - 1 << endl;
  return 0;
}
