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 wi <= W: ans = max(ans, vi) print(ans)