N,M=map(int,input().split()) A=[1%N]*N for i in range(N): for j in range(M):A[i]=A[i]*i%N print("YNeos"[len(set(A))