import math K, N = map(int, input().split()) L = [] for n in range(1, N + 1): if n % K ==0: z = math.sqrt(n / K) x = n ** (1/6) y = n ** (1/4) if z ** 2 * K == x ** 6 + y ** 4: L.append(n) print(L)