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