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()) c = math.floor(b) b -= c decimal.getcontext().prec = 1000 z = pow(a,b) if z == math.floor(z): print('Yes') else: print('No')