""" """ N,M = map(int,input().split()) A = [ pow(i+1,M,N) for i in range(N) ] if len(set(A)) == N: print ("Yes") else: print ("No")