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