from math import gcd a, b = map(float, input().split()) a_n = round(a * 10000) a_d = 10000 b_n = round(b * 10000) b_d = 10000 a_g = gcd(a_n, a_d) a_n //= a_g a_d //= a_g b_g = abs(gcd(b_n, b_d)) b_n //= b_g b_d //= b_g if b_n == 0: print("Yes") exit() if b_n < 0: b_n *= -1 a_n, a_d = a_d, a_n if a_d != 1: print("No") exit() a = a_n x = int(pow(a, 1 / b_d)) while pow(x, b_d) < a: x += 1 while pow(x, b_d) > a: x -= 1 if pow(x, b_d) == a: print("Yes") else: print("No")