#include #define rep(i, n) for(int i = 0; i < (int)(n); i++) #define all(x) (x).begin(),(x).end() #define rall(x) (x).rbegin(),(x).rend() #define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() ); using namespace std; using ll = long long; int main(){ int n, x; cin >> n >> x; map m; rep(i, n){ int a; cin >> a; m[a]++; } ll ans = 0; for(auto p: m){ if(x <= p.first) continue; int t = x - p.first; if(m.find(t) != m.end()){ if(p.first == t) ans += p.second * (p.second - 1); else ans += p.second * m[t]; } } cout << ans << endl; }