#include <bits/stdc++.h>
using namespace std;
int n;
long long ans, sum, x, b[100 + 5];
int main() {
  cin >> n >> x;
  for (int i = 1; i <= n; ++i) cin >> b[i];
  sort(b + 1, b + n + 1);
  int i = 1;
  b[n + 1] = (long long)1e9;
  while (sum + b[i] <= x && i <= n) {
    if (x == sum + b[i]) {
      ++ans;
      break;
    }
    if (x - sum - b[i] < b[i]) {
      ++i;
      continue;
    }
    sum += b[i], ++ans;
    ++i;
  }
  cout << ans;
  return 0;
}
