#include #define fst(t) std::get<0>(t) #define snd(t) std::get<1>(t) #define thd(t) std::get<2>(t) #define unless(p) if(!(p)) #define until(p) while(!(p)) using ll = std::int64_t; using P = std::tuple; int N, K; int A[100100], B[100100]; int main(){ std::cin.tie(nullptr); std::ios::sync_with_stdio(false); std::cin >> N >> K; for(int i=0;i> A[i] >> B[i]; } int lb = 0, ub = 1001001001; while(ub - lb > 1){ int m = (lb + ub) / 2; ll cnt = 0; for(int i=0;i= K){ ub = m; }else{ lb = m; } } std::cout << ub << std::endl; }