N,M=map(int,input().split()) H=[0]*N for i in range(1,N+1): p=pow(i,M,N) if H[p]>0:print("No"),exit() H[p]+=1 print("Yes")