#include <bits/stdc++.h>
using namespace std;
typedef long long uint;
const int maxN = 50005;
uint A[maxN], B[maxN], C[maxN];
uint N, K;
const uint BLOCK = 5000000;
vector<uint> S; uint S_sz;
void phase1(){
uint L = B[1] + C[1], R = B[N] + C[N], mid;
uint res = R;
S_sz = min(N * N, BLOCK);
uint it;
while(L <= R){
mid = (R - L >> 1) + L;
it = N;
uint cnt = 0;
for(int i = 1; i <= N; ++i){
while(it){
if(B[i] + C[it] <= mid)break;
it--;
}
cnt += it;
}
if(BLOCK <= cnt){
res = mid;
if(mid == 0)break;
R = mid - 1;
}
else L = mid + 1;
}
S.clear(); S.reserve(S_sz);
it = N;
for(int i = 1; i <= N; ++i){
while(it){
if(B[i] + C[it] <= res)break;
it--;
}
for(int j = 1; j <= it; ++j){
S.push_back(B[i] + C[j]);
if(S.size() == S_sz)break;
}
if(S.size() == S_sz)break;
}
sort(S.begin(), S.end());
//for(uint v: S)cout << v << ' '; cout << '\n';
}
void phase2(){
uint L = A[1] + B[1] + C[1], R = A[N] + B[N] + C[N], mid;
uint res = R;
while(L <= R){
mid = (R - L >> 1) + L;
uint cnt = 0, it;
for(int i = 1; i <= N; ++i){
if(A[i] + S.back() <= mid){
it = N;
for(int j = 1; j <= N; ++j){
while(it){
if(A[i] + B[j] + C[it] <= mid)break;
it--;
}
cnt += it;
//cout << "Add 1 " << it << '\n';
}
}
else if(A[i] <= mid){
cnt += upper_bound(S.begin(), S.end(), mid - A[i]) - S.begin();
//cout << "Add 2 " << upper_bound(S.begin(), S.end(), mid - A[i]) - S.begin() << '\n';
}
if(K <= cnt)break;
}
//cout << "Calc result " << mid << ": " << cnt << '\n';
if(K <= cnt){
res = mid;
if(mid == 0)break;
R = mid - 1;
}
else L = mid + 1;
}
cout << res;
}
int main(){
if(fopen("input.txt", "r")){
freopen("input.txt", "r", stdin);
}cin.tie(NULL)->sync_with_stdio(false);
cin >> N >> K;
for(int i = 1; i <= N; ++i)cin >> A[i];
for(int i = 1; i <= N; ++i)cin >> B[i];
for(int i = 1; i <= N; ++i)cin >> C[i];
sort(A + 1, A + N + 1);
sort(B + 1, B + N + 1);
sort(C + 1, C + N + 1);
// for(int i = 1; i <= N; ++i)cout << A[i] << ' '; cout << '\n';
// for(int i = 1; i <= N; ++i)cout << B[i] << ' '; cout << '\n';
// for(int i = 1; i <= N; ++i)cout << C[i] << ' '; cout << '\n';
phase1();
phase2();
return 0;
}