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