n, k = map(int, input().split())
AB = []
for i in range(n):
    a, b = map(int, input().split())
    AB.append((a, b))

def is_ok(x):
    cnt = 0
    for a, b in AB:
        if x < a:
            continue
        elif a <= x <= b:
            cnt += x-a+1
        else:
            cnt += b-a+1
    if cnt >= k:
        return True
    else:
        return False

ng = 0
ok = 10**9+1
while ng+1<ok:
    c = (ng+ok)//2
    if is_ok(c):
        ok = c
    else:
        ng = c
print(ok)