n, w = map(int, input().split(" ")) print(max(map(lambda x: -1 if x[1] > w else x[0], [list(map(int, input().split(" "))) for _ in range(n)])))