#include <bits/stdc++.h>
using namespace std;
signed main(){
long long n, k;
cin >> n >> k;
vector<int> a(n);
vector<int> b(n);
for(int i = 0; i < n; i++){
cin >> a[i];
}
for(int i = 0; i < n; i++){
cin >> b[i];
}
sort(a.begin(), a.end());
sort(b.begin(), b.end());
long long l = 1, r = 2e9;
while(l <= r){
long long mid = (l + r) / 2;
int sum = 0;
for(int i = 0, j = n - 1; i < n; i++){
while(a[i] + b[j] > mid && j > 0) j--;
sum += j + 1;
}
if(sum > k){
r = mid - 1;
}else if(sum < k){
l = mid + 1;
}
}
cout << l;
}
// 2 4 4 6 8
// 1 3 5 7 9
I2luY2x1ZGUgPGJpdHMvc3RkYysrLmg+CnVzaW5nIG5hbWVzcGFjZSBzdGQ7CnNpZ25lZCBtYWluKCl7CiAgICBsb25nIGxvbmcgbiwgazsKICAgIGNpbiA+PiBuID4+IGs7CiAgICB2ZWN0b3I8aW50PiBhKG4pOwogICAgdmVjdG9yPGludD4gYihuKTsKICAgIGZvcihpbnQgaSA9IDA7IGkgPCBuOyBpKyspewogICAgICAgIGNpbiA+PiBhW2ldOwogICAgfQogICAgZm9yKGludCBpID0gMDsgaSA8IG47IGkrKyl7CiAgICAgICAgY2luID4+IGJbaV07CiAgICB9CiAgICBzb3J0KGEuYmVnaW4oKSwgYS5lbmQoKSk7CiAgICBzb3J0KGIuYmVnaW4oKSwgYi5lbmQoKSk7CiAgICBsb25nIGxvbmcgbCA9IDEsIHIgPSAyZTk7CiAgICB3aGlsZShsIDw9IHIpewogICAgICAgIGxvbmcgbG9uZyBtaWQgPSAobCArIHIpIC8gMjsKICAgICAgICBpbnQgc3VtID0gMDsKICAgICAgICBmb3IoaW50IGkgPSAwLCBqID0gbiAtIDE7IGkgPCBuOyBpKyspewogICAgICAgICAgICB3aGlsZShhW2ldICsgYltqXSA+IG1pZCAmJiBqID4gMCkgai0tOwogICAgICAgICAgICBzdW0gKz0gaiArIDE7CiAgICAgICAgfQogICAgICAgIGlmKHN1bSA+IGspewogICAgICAgICAgICByID0gbWlkIC0gMTsKICAgICAgICB9ZWxzZSBpZihzdW0gPCBrKXsKICAgICAgICAgICAgbCA9IG1pZCArIDE7CiAgICAgICAgfQogICAgfQogICAgY291dCA8PCBsOwp9Ci8vIDIgNCA0IDYgOAovLyAxIDMgNSA3IDkgCg==