def make_divisors(n): lower_divisors , upper_divisors = [], [] i = 1 while i*i <= n: if n % i == 0: lower_divisors.append(i) if i != n // i: upper_divisors.append(n//i) i += 1 return lower_divisors + upper_divisors[::-1] import math,decimal a,b = map(decimal.Decimal,input().split()) if a != math.floor(a): print('No') exit() a = int(a) b = abs(b) for i in make_divisors(a): for j in range(30): if pow(i,j) == a: z = decimal.Decimal(j) * b if z == math.floor(z): exit(print('Yes')) if pow(i,j) > a: break print('No')