#include #include #include using namespace std; int main(void){ int N, X; cin >> N >> X; if(X > 200000){ cout << 0 << endl; return 0; } vector a(N); for(int i = 0; i < N; i++){ cin >> a[i]; } vector S(200001, 0); for(int i = 0; i < N; S[a[i]]++, i++) {} long ans = 0; for(int i = 0; i < N; i++){ if(a[i] > X){ continue; } if(a[i] == X - a[i]){ ans += S[a[i]] * S[a[i]]; S[a[i]] = 0; }else{ ans += 2 * S[a[i]] * S[X-a[i]]; S[a[i]] = 0; S[X - a[i]] = 0; } } cout << ans << endl; return 0; }