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