#include <bits/stdc++.h>
using namespace std;
#define int unsigned int
signed main(){
int n;
long long 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());
int l = 1, r = 2e9;
while(l <= r){
int mid = (l + r) / 2;
long long sum = 0;
for(int i = 0, j = 0; i < n; i++){
while(a[i] + b[j] <= mid && j < n) j++;
while(a[i] + b[j] > mid && j > 0) j--;
// cout << j << endl;
sum += j;
}
cout << l << " " << r << " " << sum << endl;
if(sum > k){
r = mid - 1;
}else if(sum < k){
l = mid + 1;
}else{
cout << mid;
break;
}
}
}
// 2 4 4 6 8
// 1 3 5 7 9
I2luY2x1ZGUgPGJpdHMvc3RkYysrLmg+CnVzaW5nIG5hbWVzcGFjZSBzdGQ7CiNkZWZpbmUgaW50IHVuc2lnbmVkIGludApzaWduZWQgbWFpbigpewoJaW50IG47Cglsb25nIGxvbmcgazsKCWNpbiA+PiBuID4+IGs7Cgl2ZWN0b3I8aW50PiBhKG4pOwoJdmVjdG9yPGludD4gYihuKTsKCWZvcihpbnQgaSA9IDA7IGkgPCBuOyBpKyspewoJCWNpbiA+PiBhW2ldOwoJfQoJZm9yKGludCBpID0gMDsgaSA8IG47IGkrKyl7CgkJY2luID4+IGJbaV07Cgl9Cglzb3J0KGEuYmVnaW4oKSwgYS5lbmQoKSk7Cglzb3J0KGIuYmVnaW4oKSwgYi5lbmQoKSk7CglpbnQgbCA9IDEsIHIgPSAyZTk7Cgl3aGlsZShsIDw9IHIpewoJCWludCBtaWQgPSAobCArIHIpIC8gMjsKCQlsb25nIGxvbmcgc3VtID0gMDsKCQlmb3IoaW50IGkgPSAwLCBqID0gMDsgaSA8IG47IGkrKyl7CgkJCXdoaWxlKGFbaV0gKyBiW2pdIDw9IG1pZCAmJiBqIDwgbikgaisrOwoJCQl3aGlsZShhW2ldICsgYltqXSA+IG1pZCAmJiAgai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