#include #include #include #include #include #include #include #include #include #include #include #include using namespace std; typedef long long ll; #define MOD 1000000007 int main() { int n, x; cin >> n >> x; vector a(n); for (int i = 0; i < n; ++i) { cin >> a[i]; } sort(a.begin(), a.end()); ll ans = 0; for (int i = 0; i < n; ++i) { auto u = upper_bound(a.begin(), a.end(), x - a[i]); auto l = lower_bound(a.begin(), a.end(), x - a[i]); ans += u - l; } cout << ans << endl; return 0; }