import sys; input = sys.stdin.readline N, W = map(int, input().split()) ans = -1 for _ in range(N): vi, wi = map(int, input().split()) if W < wi: continue if ans < vi: ans = vi print(ans)