#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,s,n) for(int i=s;i<n;i++)
typedef long long ll;
const ll INF = 1e10;
int main(){
    ll n, v;
    cin >> n >> v;
    ll a[4][n];
    rep(i,4)rep(j,n)cin >> a[i][j];
    vector<ll> b, c;
    rep(i,n)rep(j,n){
        b.push_back(a[0][i] + a[1][j]);
        c.push_back(a[2][i] + a[3][j]);
    }
    sort(b.begin(), b.end());
    sort(c.begin(), c.end());
    
    ll r = 0;
    rep(i,b.size())r += upper_bound(c.begin(), c.end(), v - b[i]) - lower_bound(c.begin(), c.end(), v - b[i]);
    cout << r << endl;
    return 0;
}
