#include #include #include typedef long long ll; ll a[100000]; int main(){ ll N,X; scanf("%lld",&N); scanf("%lld",&X); for(int i = 0; i < N; i++) scanf("%lld",a+i); std::sort(a,a+N); int left = 0, right = N-1; int cnt = 0; while(1){ while(a[left]+a[right]>X){ right--; if(left >= right) break; } if(a[left]+a[right] == X){ if(left==right) cnt += 1; else cnt += 2; right--; }else{ left++; } if(left > right) break; } printf("%d\n",cnt); }