N,W = map(int,input().split()) bag = [] for i in range(N): v,w = map(int,input().split()) bag.append([v,w]) ans = -1 for a,b in bag: if b <= W: ans = max(ans,a) print(ans)