#include <bits/stdc++.h>
using namespace std;
int main() {
  int N, x;
  int a[101];
  cin >> N >> x;
  for (int i = 1; i <= N; i++) cin >> a[i];
  sort(a + 1, a + N + 1);
  int count = 0;
  int sum = 0;
  for (int i = 1; i <= N; i++) {
    if (x <= sum) break;
    sum += a[i];
    count++;
  }
  cout << count << endl;
  return 0;
}
