#include using namespace std; typedef long long ll; template ostream& operator<<(ostream &os, vector &v){ string sep = " "; if(v.size()) os << v[0]; for(int i=1; i istream& operator>>(istream &is, vector &v){ for(int i=0; i> v[i]; return is; } #ifdef DBG void debug_(){ cout << endl; } template void debug_(T&& x, Args&&... xs){ cout << x << " "; debug_(forward(xs)...); } #define dbg(...) debug_(__VA_ARGS__) #else #define dbg(...) #endif int main() { ios_base::sync_with_stdio(false); cout << setprecision(20) << fixed; int n; ll k, p; cin >> n >> k >> p; vector a(n), b(n); cin >> a >> b; sort(a.begin(), a.end()); sort(b.begin(), b.end()); ll lb=-1, ub=p; while(ub-lb>1){ ll x = (ub+lb)/2; ll m = 0; for(int i=0; i