N, W = map(int, input().split()) W_below = [] for i in range(N): v, w = map(int, input().split()) if w <= W: W_below.append(v) if len(W_below) == 0: print(-1) else: print(max(W_below))