a,b = map(int,input().split()) if a > b: a,b = b,a if b%a: print("No") else: p = b//a if pow(a,p) == b: print("Yes") else: print("No")