#from collections import defaultdict N, K = map(int, input().split()) K -= 1 shikiri = set() LR = [] for i in range(N): a, b = map(int, input().split()) shikiri.add(a) shikiri.add(b + 1) LR.append((a, b + 1)) nums = sorted(shikiri) d = {} id = 0 for num in nums: d[num] = id id += 1 L = len(d) cnt = [0] * (L + 1) for l, r in LR: l = d[l] r = d[r] cnt[l] += 1 cnt[r] -= 1 # 左から累積 for i in range(L): cnt[i + 1] += cnt[i] # nums と cnt で答えが出せる total = 0 for i in range(L - 1): pos, nex = nums[i], nums[i + 1] # pos ~ nex - 1 までの nex - 1 - (pos - 1) = nex - pos 個の整数が cnt[i] 個*ずつ*存在する subtotal = (nex - pos) * cnt[i] if total + subtotal < K: # 次の区間に行く total += subtotal else: # この区間にK番目が存在する nokori = K - total sho, amari = divmod(nokori, cnt[i]) ans = pos + sho exit(print(ans))