N,M=map(int,input().split()) print("YNeos"[len(set(pow(i,M,N)for i in range(1,N+1)))