#include #include #include using namespace std; #define REP(i,n) for(int i = 0; i < (n); ++i) #define P(x) cout << (x) << "\n" #define D(x) cerr << (x) << "\n" #define fcout cout << fixed << setprecision(18) using i64=long long int; // 10^18 vector a; bool isOK(i64 index, i64 key){ if(a[index] >= key) return true; else return false; } i64 binary_search(i64 key) { i64 ng = -1; i64 ok = (int)a.size(); while(abs(ok - ng) > 1){ i64 mid = ng + (ok - ng) / 2; if(isOK(mid, key))ok = mid; else ng = mid; } return ok; } int main(){ ios::sync_with_stdio(false); cin.tie(0); int n;cin>>n; i64 x;cin>>x; REP(i,n){ i64 in;cin>>in; a.push_back(in); } i64 sum=0; sort(a.begin(), a.end()); for(auto xx:a){ sum += binary_search(x - xx + 1) - binary_search(x - xx); } P(sum); return 0; }