#include <bits/stdc++.h>
using namespace std;
const long long INF = 100000000000000001;
struct edge {
  int to, cost;
};
int dy[] = {0, 0, 1, -1};
int dx[] = {1, -1, 0, 0};
struct Road {
  double cost;
  int a, b;
};
int main() {
  long long n, x;
  long long a[101];
  long long e = 0, t = 0, u = 0, ans = 0;
  cin >> n >> x;
  for (int i = 0; i < n; ++i) {
    cin >> a[i];
    e += a[i];
  }
  if (e == x) {
    ans = n;
  }
  if (e > x) {
    sort(a, a + n);
    for (int i = 0; i < n; ++i) {
      if (x - a[i] >= 0) {
        t++;
      }
    }
    ans = t;
  }
  if (e < x) {
    sort(a, a + n, greater<int>());
    for (int i = 0; i < n; ++i) {
      if (x - a[i] > a[i + 1]) {
        u++;
      }
    }
    ans = u - 1;
  }
  cout << ans << endl;
  return 0;
}
