#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
int main(){
  int n;
  long long co=0;
  long long v;
  cin >> n >> v;
  vector<vector<long long> >a(4,vector<long long>(n,0));
  vector<long long>b;
  vector<long long>c;
  for(int i=0;i<4;i++){
    for(int j=0;j<n;j++){
      cin >> a[i][j];
    }
  }
  for(int i=0;i<n;i++){
    for(int j=0;j<n;j++){
      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());
  for(int i=0;i<b.size();i++){
    co+=upper_bound(c.begin(),c.end(),v-b[i])-lower_bound(c.begin(),c.end(),v-b[i]);
  }
  cout << co << endl;
  return 0;
}