from collections import * from itertools import * from functools import * from heapq import * import sys,math input = sys.stdin.readline N,K = map(int,input().split()) AB = [tuple(map(int,input().split())) for _ in range(N)] def is_ok(x): tmp = 0 for a,b in AB: if x=K x = 0 y = 10**9 while y-x>1: mid = (y+x)//2 if is_ok(mid): y = mid else: x = mid print(y)