#include #define rep(i,n) for(int i=0;i ; const int INF = 1e9; const int MOD = 1000000007; ll n = 100005,k; vector

section(n); bool ok(ll x){ ll cnt = 0; rep(i,n){ ll l = section[i].first-1,r = section[i].second+1; while(r - l > 1){ ll m = (l + r)/2; if(m < x) l = m; else r = m; } cnt += r - section[i].first ; } return cnt < k; } int main(){ cin >> n >> k; rep(i,n){ cin >> section[i].first >> section[i].second; } ll left = -1,right = INF + 1; while(right - left > 1){ ll mid = (left + right)/2; if(ok(mid)) left = mid; else right = mid; } cout << left << endl; return 0; }