#include namespace nono { struct Init {}; void solve([[maybe_unused]] const Init& init) { long long n, m; std::cin >> n >> m; std::vector a(n); for (int i = 0; i < n; i++) std::cin >> a[i]; if (m % 2 == 1) { std::cout << 0 << std::endl; return; } long long half = m / 2; std::set s(a.begin(), a.end()); long long ans = 0; for (auto v: a) { if (s.contains(v + half)) { ans += n - 2; } } std::cout << ans << std::endl; } } // namespace nono int main() { std::cin.tie(0)->sync_with_stdio(0); std::cout << std::fixed << std::setprecision(16); int t = 1; nono::Init init; while (t--) nono::solve(init); }