#include using namespace std; signed main() { ios::sync_with_stdio(false); 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 lb = lower_bound(A.begin(), A.end(), X - A[i]) - A.begin(); int rb = upper_bound(A.begin(), A.end(), X - A[i]) - A.begin(); ans += rb - lb; } cout << ans << endl; return 0; }