# include <bits/stdc++.h>
const int32_t maxn = 100005;
const int64_t inf = 3e9;
int64_t n, k, s;
int64_t a[maxn], b[maxn], c[maxn];
std::vector <int32_t> used;
inline int64_t rnk (const int64_t val, const int64_t lim) {
int64_t rk = 0, pos = 0;
if (!used.empty ()) return std::lower_bound (used.begin (), used.end (), val) - used.begin ();
if (val < 0) return 0;
if (val > a[std::min (lim / n + 1, n)] + b[n]) return n * n;
if (val > a[n] + b[std::min (lim / n + 1, n)]) return std::cerr << val << '\n', n * n;
pos = std::lower_bound (a + 1, a + n + 1, val - b[1]) - a - 1;
for (int i = 1; i <= n; ++ i) {
while (pos > 0 && a[pos] >= val - b[i]) -- pos;
rk += pos;
}
return rk;
}
inline int64_t check (const int64_t val) {
int64_t rk = 0;
for (int i = 1; i <= n; ++ i) {
rk += rnk (val - c[i], k - rk);
if (rk >= k) return rk;
}
return rk;
}
inline void getans (int64_t & ans, const int64_t x) {
int64_t a = check (x - 2), b = check (x - 1), c = check (x), d = check (x + 1), e = check (x + 2);
std::cerr << a << ' ' << b << ' ' << c << ' ' << d << ' ' << e << ' ' << x << '\n';
if (a < k && k <= b) return ans = x - 2, void ();
if (b < k && k <= c) return ans = x - 1, void ();
if (c < k && k <= d) return ans = x, void ();
if (d < k && k <= e) return ans = x + 1, void ();
if (e < k) return ans = x + 2, void ();
}
inline int64_t getmax () {
int64_t res = inf;
for (int i = k / n + 1; i <= n; ++ i)
res = std::min ({res, a[i] + b[k / i + 1] + c[1], a[i] + c[k / i + 1] + b[1], b[i] + a[k / i + 1] + c[1], b[i] + c[k / i + 1] + a[1], c[i] + a[k / i + 1] + b[1], c[i] + b[k / i + 1] + a[1]});
return res;
}
int64_t ans = 0;
int main () {
// freopen ("turtle.in", "r", stdin);
// freopen ("turtle.out", "w", stdout);
std::ios::sync_with_stdio (0);
std::cin.tie (0), std::cout.tie (0);
std::cin >> n >> k;
for (int i = 1; i <= n; ++ i) std::cin >> a[i];
for (int i = 1; i <= n; ++ i) std::cin >> b[i];
for (int i = 1; i <= n; ++ i) std::cin >> c[i];
std::sort (a + 1, a + n + 1);
std::sort (b + 1, b + n + 1);
std::sort (c + 1, c + n + 1);
// s = std::sqrt (k / n) + 1;
s = std::min (n, 1000ll);
int64_t l = 0, r = inf, m = 0;
while (l < r) {
m = (l + r) >> 1;
if (rnk (m, k) >= std::sqrt (n * k)) r = m;
else l = m + 1;
}
if (n * n < 1e7) {
for (int i = 1; i <= n; ++ i)
for (int j = 1; j <= n; ++ j)
used.push_back (a[i] + b[j]);
} else {
for (int i = 1; i <= n; ++ i)
for (int x = 1; a[x] + b[i] < m && x <= n && used.size () <= 1e7; ++ x)
used.push_back (a[x] + b[i]);
std::cerr << "siz " << used.size () << " lim " << m << '\n';
for (int i = 1; i <= n; ++ i)
for (int x = 1; a[x] + b[i] == m && x <= n && used.size () <= 1e7; ++ x)
used.push_back (a[x] + b[i]);
}
std::sort (used.begin (), used.end ());
// std::cerr << getmax () << '\n';
l = 0, r = getmax (), m = 0;
while (l < r) {
m = (l + r) >> 1;
if (check (m) >= k) r = m - 1;
else l = m + 1;
}
getans (ans, m);
std::cout << ans << '\n';
return 0;
}