#include //#include "atcoder/all" typedef long long int ll; using namespace std; // using namespace atcoder; #define MAXN 100001 ll a[MAXN]; ll cnt[MAXN]; int main() { ll n, x; cin >> n >> x; memset(cnt, 0, sizeof(cnt)); for (int i = 1; i <= n; i++) { ll ax; cin >> ax; a[i] = ax; cnt[ax]++; } ll ret = 0; for (int i = 1; i <= n; i++) { if ((x - a[i] < 0) || (x - a[i] > 100000)) continue; ret += cnt[x - a[i]]; } cout << ret << endl; return 0; }