n, m = map(int, input().split()) C = set() for now in range(1, n+1): t = pow(now, m, n) if t in C: exit(print("No")) C.add(t) print("Yes")