#include #define REP(i, m, n) for(int i = (int)(m); i < (int)(n); ++i) #define rep(i, n) REP(i, 0, n) using namespace std; using ll = long long; using ld = long double; template inline bool chmax(T &a, const U &b) { if(a < b) { a = b; return true; } return false; } template inline bool chmin(T &a, const U &b) { if(a > b) { a = b; return true; } return false; } int n, x, a[100000]; int main() { cin.tie(0); ios::sync_with_stdio(false); cin >> n >> x; rep(i, n) cin >> a[i]; map cnt; rep(i, n) { cnt[x-a[i]]++; } ll ans = 0; rep(i, n) { ans += cnt[a[i]]; } cout << ans << '\n'; return 0; }