/* hng */
#include <bits/stdc++.h>
/*
#pragma GCC optimize("O3,unroll-loops")
#pragma GCC target("avx2,bmi,bmi2,lzcnt,popcnt")
*/
#define fast                     \
    ios::sync_with_stdio(false); \
    cin.tie(nullptr);            \
    cout.tie(nullptr);
#define fi first
#define se second
#define pr pair
#define ll long long
#define ull unsigned long long
#define db double
#define vt vector
#define pb(a) push_back(a) //push_back()
#define umap unordered_map
#define ln '\n'
using namespace std;

const string NAME = "test";
const ll MAXN = 1e6 + 36;
const ll MOD = 1e9 + 7;
const ll lmin = LLONG_MIN;
const ll lmax = LLONG_MAX;
/*-------------------------------------------------------------*/
int main()
{
    fast;

    #ifndef ONLINE_JUDGE
    freopen((NAME + ".inp").c_str(), "r", stdin);
    freopen((NAME + ".out").c_str(), "w", stdout);
    #endif

    auto start = chrono::steady_clock::now();

    ll n, k;
    cin >> n >> k;

    ll x;
    umap<ll, ll> cnt;
    ll ans = 0;

    while (n--)
    {
        cin >> x;
        ans += cnt[x];
        cnt[k - x]++;
    }
    
    cout << ans;

    auto end = chrono::steady_clock::now();
    cerr << "Time = " << chrono::duration<double>(end - start).count() << 's';
}
