#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
using namespace std;
int n, x, a[101], ans;
int main() {
  cin >> n >> x;
  for (int i = 0; i < n; i++) cin >> a[i];
  sort(a, a + n);
  for (int i = 0; i < n; i++) {
    if (x >= a[i] * 2 || a[i] == x) x -= a[i], ans++;
  }
  cout << ans << '\n';
}
