n,m=map(int,input().split()) L=[pow(i,m,n) for i in range(1,n+1)] print("Yes" if len(set(L))==n else "No")