n,w=map(int,input().split()) r=-1 for i in range(n): v,u=map(int,input().split()) if u<=w:r=max(r,v) print(r)