N,M=map(int,input().split()) print("YNeos"[sorted(pow(i,M,N)for i in range(1,N+1))!=list(range(N))::2])