#include using namespace std; typedef long long ll; #define tr(container, it) \ for (auto it = container.begin(); it != container.end(); it++) #define scontains(c, x) ((c).find(x) != (c).end()) //O(log n) #define contains(c, x) (find((c).begin(),(c).end(),x) != (c).end()) //O(n) #define ill(_x) ll _x;scanf("%lld",&_x); #define idb(_x) double _x;scanf("%lf",&_x); #define all(x) (x).begin(),(x).end() #define pll pair #define mll map #define vll vector #define sll set #define vs vector #define in0(x, a, b)((x)>=a && (x)<=b ) #define in1(x, a, b)((x)>a && (x) (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end))) #define gcd __gcd const double pi = 3.14159265358979323846; const int INF = 0x3f3f3f3f; const int MOD = (int)(1e9+7); map m; void _(){ int n,x; ll ans = 0; cin >> n >> x; for (int i = 0; i < n; ++i) { int t; cin >> t; m[t] ++; } for(auto p : m) ans += p.second * m[x - p.first]; cout << ans; } int main() { #ifdef Debug freopen("/home/joduskame/Desktop/cpp/IO/Input.txt", "r", stdin); freopen("/home/joduskame/Desktop/cpp/IO/Output.txt", "w", stdout); #endif ios_base::sync_with_stdio(false); cin.tie(NULL); _(); return 0; }