#include #include #include #include #include #include #include #include #include using namespace std; using i64 = int64_t; constexpr i64 mod = 1e9 + 7; using vi = vector; using vvi = vector; using ii = pair; using vii = vector; int main() { int n, x; cin >> n >> x; vi as; for (int i = 0; i < n; i++) { int a; cin >> a; as.push_back(a); } sort(as.begin(), as.end()); i64 cnt = 0; for (int i = 0; i < n; i++) { int f = x - as[i]; cnt += upper_bound(as.begin(), as.end(), f) - lower_bound(as.begin(), as.end(), f); } cout << cnt << endl; }