#include using namespace std; #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define llong long long int main() { int n, x; cin >> n >> x; map a; set keys; rep(i, n) { int val; cin >> val; if(a.count(val)) a[val]++; else a[val] = 1; keys.insert(val); } llong result = 0LL; for(pair p: a) { if(p.first > x) break; if(a.count(x - p.first)) { result += (llong)a[p.first] * a[x - p.first]; } } cout << result << "\n"; }