from math import gcd n,m= map(int,input().split()) def p(n): a = [] while n % 2 == 0: a.append(2) n //= 2 f = 3 while f * f <= n: if n % f == 0: a.append(f) n //= f else: f += 2 if n != 1: a.append(n) sa=set(a) return sa g=gcd(n,m) n//=g m//=g if m%n != 0 or n == 1: sa=p(m) if len(sa) == 2: a,b =sorted(list(sa)) if a == 2 and b == 5: print('No') else: print('Yes') elif len(sa) ==1: t=sa.pop() if 2 == t or 5 == t: print('No') else: print('Yes') else: print('Yes') else: print('No')