N,M=map(int, input().split()) now=1 D=set() for i in range(1,N+1): p=pow(i,M,N) D.add(p) if len(D)==N: print('Yes') else: print('No')