n,m=map(int,input().split()) a=[pow(i,m,n)for i in range(1,n+1)] if len({*a})==n: print('Yes') else: print('No')