#include namespace MyLib { constexpr uint_fast32_t pow_mod(uint_fast64_t a, uint_fast64_t b, const uint_fast32_t mod) noexcept { if (mod == 1) return 0; uint_fast32_t ans = 1; a %= mod; for (; b != 0; b >>= 1, a = a * a % mod) if (b & 1) ans = ans * a % mod; return ans; } } static inline constexpr const char* solve(const uint_fast32_t N, const uint_fast32_t M) noexcept { std::vector is_appeared(N, false); for (uint_fast32_t i = 0; i != N; ++i) { const uint_fast32_t A = MyLib::pow_mod(i, M, N); if (is_appeared[A]) return "No"; is_appeared[A] = true; } return "Yes"; } int main() { std::cin.tie(nullptr); std::ios::sync_with_stdio(false); uint_fast32_t N, M; std::cin >> N >> M; std::cout << solve(N, M) << '\n'; return 0; }