def II(): return int(input()) def MI(): return map(int, input().split()) def TI(): return tuple(MI()) def LI(): return list(MI()) #str-input def SI(): return input() def MSI(): return input().split() def SI_L(): return list(SI()) def SI_LI(): return list(map(int, SI())) #multiple-input def LLI(n): return [LI() for _ in range(n)] def LSI(n): return [SI() for _ in range(n)] #1-indexを0-indexでinput def MI_1(): return map(lambda x:int(x)-1, input().split()) def TI_1(): return tuple(MI_1()) def LI_1(): return list(MI_1()) class fenwick_tree(): n=1 data=[0 for i in range(n)] def __init__(self,N): self.n=N self.data=[0 for i in range(N)] def add(self,p,x): assert 0<=p0): s+=self.data[r-1] r-=r&-r return s class dsu(): n=1 parent_or_size=[-1 for i in range(n)] def __init__(self,N): self.n=N self.parent_or_size=[-1 for i in range(N)] def merge(self,a,b): assert 0<=a0: result2.append(result[i]) return result2 def lis(l): #最長増加部分列 n = len(l) tmp = [] # いまi文字目に使える最小 idxlist = [None] * n # l[i]が使われた場所 for i in range(n): numidx = bisect_right(tmp, l[i]) if numidx == len(tmp): tmp.append(l[i]) else: tmp[numidx] = l[i] idxlist[i] = numidx # LIS復元 look = len(tmp) - 1 ans = [0] * (look + 1) idx = [0] * (look + 1) # 後ろから見ていく for i in range(n-1,-1,-1): if idxlist[i] == look: ans[look] = l[i] # ansを確定 idx[look] = i look -= 1 return ans,idx from bisect import bisect_left,bisect_right from fractions import Fraction def primefact(n:int): #素因数分解 """素因数分解""" p = 2 pf = dict() while p*p <= n: if n%p == 0: cnt = 0 while n%p == 0: n //= p cnt += 1 pf[p] = cnt p += 1 if n != 1: pf[n] = 1 return pf from math import comb,ceil,floor,factorial,gcd a,b = input().split() a = Fraction(a) b = Fraction(b) if b == 0: print("Yes") exit() if b < 0: b = -b a = 1/a if a != int(a): print("No") else: k = primefact(int(a)) e = [i for i in k.values()] t = gcd(*e) b *= t if b != int(b): print("No") else: print("Yes")