def Main(): n,w=map(int,input().split()) ans=-1 for _ in range(n): x,y=map(int,input().split()) if y<=w: ans=max(ans,x) print(ans) Main()