#include #include using namespace std; #define ll long long #define rep(i,n) for(int (i)=0;(i)<(n);(i)++) #define repeat(i,s,n) for(int (i)=s; (i)<(n); (i)++) #define revrep(i,n) for(int (i)=(n)-1;i>=0; i--) int main() { cin.tie(0); ios::sync_with_stdio(false); cout<::max_digits10); int n; cin>>n; ll x; cin>>x; vector a(n); rep(i,n)cin>>a[i]; vector c(1000000); rep(i,n)c[a[i]]++; ll ans=0; rep(y,1000000) { ll z = x-y; if(z>=0) { ans+=c[z]*c[y]; } } cout << ans << endl; return 0; }