#include "bits/stdc++.h"

using namespace std;

//------------------------------- Libraries --------------------------------//

//------------------------------- Type Names -------------------------------//

using i64 = int_fast64_t;

using seika = string;
//akari : 1D, yukari : 2D, maki : 3D vector
template <class kizuna>
using akari = vector<kizuna>;
template <class yuzuki>
using yukari = akari<akari<yuzuki>>;
template <class tsurumaki>
using maki = akari<yukari<tsurumaki>>;
//akane : ascending order, aoi : decending order
template <class kotonoha>
using akane = priority_queue<kotonoha, akari<kotonoha>, greater<kotonoha>>;
template <class kotonoha>
using aoi = priority_queue<kotonoha>;

//------------------------------- Dubug Functions ---------------------------//
inline void print()
{
    cout << endl;
}
template <typename First, typename... Rest>
void print(const First &first, const Rest &... rest)
{
    cout << first << ' ';
    print(rest...);
}
//------------------------------- Solver ------------------------------------//

void solve()
{
    int n;
    i64 v;
    cin >> n >> v;
    akari<i64> as(n), bs(n), cs(n), ds(n);
    for (int i = 0; i < n; i++)
        cin >> as[i];
    for (int i = 0; i < n; i++)
        cin >> bs[i];
    for (int i = 0; i < n; i++)
        cin >> cs[i];
    for (int i = 0; i < n; i++)
        cin >> ds[i];
    map<i64, i64> mp[2];
    for (int i = 0; i < n; i++)
        for (int j = 0; j < n; j++)
        {
            mp[0][as[i] + bs[j]]++;
        }
    for (int i = 0; i < n; i++)
        for (int j = 0; j < n; j++)
        {
            mp[1][cs[i] + ds[j]]++;
        }
    i64 ans = 0;
    for (auto &p : mp[0])
    {
        ans += mp[1][v - p.first] * p.second;
    }
    cout << ans << endl;
}

int main()
{
    solve();
    return 0;
}

