#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, x;
  cin >> n >> x;
  int ans = 0;
  vector<int> a(n);
  for (int i = 0; i < n; ++i) {
    cin >> a[i];
  }
  sort(a.begin(), a.end());
  for (int i = 0; i < n; ++i) {
    if (i == n - 1) {
      if (a[i] % x == 0) ++ans;
    } else {
      x -= a[i];
      ++ans;
    }
    if (x == 0) break;
  }
  cout << ans << endl;
  return 0;
}
