#include <bits/stdc++.h>
using namespace std;
int main(void) {
  long long n, x;
  cin >> n >> x;
  vector<long long> a(n);
  for (int i = 0; i < n; i++) {
    cin >> a.at(i);
  }
  sort(a.begin(), a.end());
  int count = 0;
  for (int i = 0; i < n; i++) {
    if (i == n - 1 && x % a.at(i) != 0) count--;
    if (x < a.at(i)) break;
    x -= a.at(i);
    count++;
  }
  cout << count << endl;
}
