n,W=map(int,input().split()) ans=-1 for _ in range(n): v,w=map(int,input().split()) if w<=W: ans=max(ans,v) print(ans)