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