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