#include <bits/stdc++.h>
using namespace std;
const int mxN = 2e5;
const long double pi = 4.0 * atanl(1.0);
const int iinf = 1e9 + 10;
const int inf = 1e18 + iinf + 10;
const int mod = 1000000007;
const long double prec = .000001;
int n, m, t, a[mxN];
vector<int> v;
void fast() { ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0); }
int main() {
  fast();
  cin >> n >> m;
  int s = 0;
  for (int i = 0; i < n; ++i) {
    cin >> a[i];
    s += a[i];
  }
  if (s == m)
    cout << n;
  else
    cout << n - 1;
  return 0;
}
