#include using namespace std; #define rep(i,n) for(int i = 0; i < (n);i++) #define sz(x) int(x.size()) typedef long long ll; typedef pair P; const int INF = 2e9; int main(){ int n, x; cin >> n >> x; vector a(n); rep(i,n) cin >> a[i]; sort(a.begin(), a.end()); ll res = 0; rep(i,n) { int b = x - a[i]; auto l = lower_bound(a.begin(),a.end(),b) - a.begin(); auto r = upper_bound(a.begin(),a.end(),b) - a.begin(); res += r-l; } cout << res << endl; return 0; }