#include using namespace std; #define rep(i, n) for (int i = 0; i < (n); ++i) using ll = long long; using ull = unsigned long long; int main() { cin.tie(nullptr)->sync_with_stdio(false); int n, x; cin >> n >> x; vector a(n); rep(i, n) cin >> a[i]; map cnt; ll ans = 0; rep(i, n) { if (cnt.contains(x - a[i])) ans += 2 * cnt[x - a[i]]; if (a[i] * 2 == x) ans++; cnt[a[i]]++; } cout << ans << '\n'; return 0; }