n,m=map(int,input().split()) st = set() for i in range(1,n+1): st.add(pow(i,m,n)) if len(st)==n: print('Yes') else: print('No')