#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n, x, a[100], val = 0, count = 0;
  cin >> n >> x;
  for (int i = 0; i < 100; i++) {
    a[i] = 99999999999;
  }
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  while (1) {
    val = 99999999999;
    for (int i = 0; i < n; i++) {
      if (val > a[i]) {
        val = a[i];
        a[i] = 99999999999;
      }
    }
    if (x < 0) {
      cout << count - 1;
      return 0;
    } else {
      count++;
      x -= val;
    }
  }
  return 0;
}
