#include using namespace std; using ll = long long; using ul = unsigned long; int main() { ios::sync_with_stdio(false); cin.tie(nullptr); ll n, x; cin >> n >> x; vector a(n); for (auto&& ia : a) cin >> ia; sort(a.begin(), a.end()); ll res{ 0 }; for (int i = 0; i < n; ++i) { if (a[i] > x) break; auto it = equal_range(a.begin(), a.end(), x - a[i]); if (it.first != a.end() && *it.first == x - a[i]) res += (it.first == it.second ? 1 : it.second - it.first); } cout << res << "\n"; return 0; }