#include using namespace std; using ll = long long; int main(){ int n, m; cin >> n >> m; unordered_set a = {}; for(int i = 0; i < n; ++i){ int x; cin >> x; a.insert(x); } if(m & 1){ cout << 0 << endl; return 0; } ll ans = 0; for(auto itr = a.begin(); itr != a.end(); ++itr){ int x = (*itr) + m / 2; if(a.find(x) == a.end()){ continue; } ans += n - 2; } cout << ans << endl; return 0; }