#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #define fix(n) cout<; const ll MOD = 1000000007; // 10^9 + 7 const int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1}; const int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1}; void solve() { ll N, X; cin >> N >> X; const ll MAX = 100000; vector nums(MAX+1, 0); rep(i, N) { ll ai; cin >> ai; nums[ai]++; } ll ans = 0; for (int i = 0; i <= min(MAX, X); i++) { ll t = X - i, tmp; if (i == t) tmp = nums[i] * nums[i]; else tmp = nums[i] * nums[t]; // debug2(i, tmp); ans += tmp; } outl(ans); } signed main() { cin.tie(0); ios::sync_with_stdio(false); srand((unsigned)time(NULL)); fix(12); solve(); }