#include #include #include #include #include #include #include #include #include using namespace std; #define REP(i,n) for(int i=0;(i)<(n);(i)++) #define ll long long int N, X; int a[100005]; int ans; signed main() { cin >> N >> X; for (int i = 0;i < N;i++) { cin >> a[i]; } sort(a, a+N); ans = 0; int l = 0; int r = N - 1; while (l < r) { int tmp = a[l] + a[r]; //cout << tmp << endl; if (tmp < X) l++; else if (tmp > X) r--; else if (tmp == X) { ans++; while (a[l] == a[l + 1] && l < N-1) { l++; ans++; } while (a[r] == a[r - 1] && r > 0) { r--; ans++; } l++; } } ans *= 2; if (a[l] + a[r] == X)ans++; cout << ans << endl; return 0; }