N, W = map(int, input().split()) v = [0] * N w = [0] * N for i in range(N): v[i], w[i] = map(int, input().split()) if w[i] > W: v[i] = -1 print(max(v))