N,M=map(int,input().split()) A=set() for x in range(1,N+1): y=pow(x,M,N) if y in A: print('No') exit() A.add(y) print('Yes')