#include <bits/stdc++.h>
using namespace std;
int main() {
  long int N, x;
  int a[110];
  cin >> N >> x;
  int total = 0;
  for (int i = 0; i < N; ++i) {
    cin >> a[i];
    total += a[i];
  }
  sort(a, a + N);
  int count = 0;
  int i = 0;
  if (total == x) {
    count = N;
  } else {
    while (true) {
      if (i + 1 == N) {
        break;
      }
      if (x - a[i] >= 0) {
        ++count;
      } else
        break;
      ++i;
    }
  }
  cout << count << endl;
}
