Source Code
#include <iostream>
#include <set>
#include <map>
#include <vector>
using namespace std;

int main() {
	int n, m, a[1000000];
	cin >> n >> m;
	
	for(int i = 0; i < n; ++i){
		cin >> a[i];
	}
	if(m == 0 && n > 1){
		long long s = 0;
		for(int i = 0; i < n; ++i){
			s += a[i];
		}
		if(s == 0){
			cout << n;
			return 0;
		}
	}
	for(int i = 0; i < n; ++i){
		if(a[i] == m){
			cout << 1 ;
			return 0;
		}
	}
	cout << 0;
	return 0;
}
Copy
Legendary Bahou
GNU G++17
2 ms
896 KB
Wrong Answer