n,W = map(int,input().split()) che = -1 for i in range(n): v,w = map(int,input().split()) if W >= w: che = max(che,v) print(che)