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