N,M=map(int,input().split()) ans=set() for i in range(1,N+1): a=i**M%N if a in ans:exit(print("No")) else:ans.add(a) print("Yes")