#include <bits/stdc++.h>
using namespace std;
void file() {}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  file();
  int n, x;
  cin >> n >> x;
  vector<int> v(n);
  int sum = 0;
  for (int i = 0; i < n; ++i) {
    cin >> v[i];
    sum += v[i];
  }
  if (sum == x) {
    cout << n << "\n";
  } else {
    cout << n - 1 << "\n";
  }
}
