#include using namespace std; #define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i ) #define rep(i,n) REP(i,0,n) typedef long long ll; int main(){ int n,k; cin>>n>>k; assert(1<=n&&n<=100000); assert(1<=k&&k<=1000000000); int l[n],r[n]; ll sum=0; rep(i,n){ cin>>l[i]>>r[i]; sum+=r[i]-l[i]+1; assert(1<=l[i]&&l[i]<=r[i]&&r[i]<=1000000000); } assert(k1){ int mid=(ok+ng)/2; ll cnt=0; rep(i,n){ if(l[i]>mid)continue; cnt+=min(r[i],mid)-l[i]+1; } if(cnt>k)ok=mid; else ng=mid; } cout<