//================================= // Created on: 2018/08/03 22:45:10 //================================= #include #define show(x) std::cerr << #x << " = " << x << std::endl using ll = long long; using ld = long double; constexpr ll MOD = 1000000007LL; template constexpr T INF = std::numeric_limits::max() / 10; std::mt19937 mt{std::random_device{}()}; int main() { int N, X; std::cin >> N >> X; std::vector A(N); for (int i = 0; i < N; i++) { std::cin >> A[i]; } std::sort(A.begin(), A.end()); ll ans = 0; for (int i = 0; i < N; i++) { const int D = X - A[i]; ans += std::upper_bound(A.begin(), A.end(), D) - std::lower_bound(A.begin(), A.end(), D); } std::cout << ans << std::endl; return 0; }