N, W = map(int, input().split()) A = [list(map(int, input().split())) for _ in range(N)] ans = -1 for v, w in A: if w <= W: ans = max(ans, v) print(ans)