#include #include #include using namespace std; int main(void) { int n, x; cin >> n >> x; vector A(n); for (int i = 0; i < n; ++i) cin >> A[i]; sort(A.begin(), A.end()); long long ans = 0; for (int i = 0; i < n; ++i) { int key = x - A[i]; auto itr1 = lower_bound(A.begin(), A.end(), key); auto itr2 = upper_bound(A.begin(), A.end(), key); ans += itr2 - itr1; } cout << ans << endl; return 0; }