def check(x): #x円以下あつめてk枚未満か? r = 0 for a,b in ab: if a <= x <= b: r += x-a+1 elif x > b: r += b-a+1 return r < k n,k = map(int,input().split()) ab = [list(map(int,input().split())) for _ in range(n)] ok = 0 ng = 10**9+1 while ng-ok > 1: mid = (ok+ng)//2 if check(mid): ok = mid else: ng = mid print(ng)