N,W=map(int,input().split()) ANS=-1 for i in range(N): v,w=map(int,input().split()) if w<=W: ANS=max(ANS,v) print(ANS)