#include using namespace std; #define rep(i, n) for (int i = 0; i < (n); ++i) using ll = long long; using ull = unsigned long long; inline int modpow(int a, int b, int m) { int res = 1; while (b) { if (b & 1) res = (ll) res * a % m; a = (ll) a * a % m; b >>= 1; } return res; } int main() { cin.tie(nullptr)->sync_with_stdio(false); int n, m; cin >> n >> m; vector a(n); rep(i, n) a[i] = modpow(i + 1, m, n); vector found(n, false); rep(i, n) found[a[i]] = true; cout << (ranges::all_of(found, identity()) ? "Yes" : "No") << '\n'; return 0; }