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