#include #define rep(i, n) for (int i = 0; i < n; ++i) typedef long long ll; using namespace std; int main() { cin.tie(0)->sync_with_stdio(0); int N, M; cin >> N >> M; set st; rep(i, N) { ll a; cin >> a; st.insert(a * 2); } ll ans = 0; for (ll s : st) { ll x = s + M; if (st.find(x) != st.end()) ans += N - 2; } cout << ans << "\n"; return 0; }