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)