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