#include #include #define rep(i, a, b) for (ll i = (ll)(a); i < (ll)(b); i++) using namespace atcoder; using namespace std; typedef long long ll; int main() { ios::sync_with_stdio(false); cin.tie(nullptr); cout << fixed << setprecision(12); int n, m; cin >> n >> m; vector cnt(n); rep(i, 1, n + 1) cnt[pow_mod(i, m, n)]++; rep(i, 0, n) if (cnt[i] == 0) { cout << "No\n"; return 0; } cout << "Yes\n"; }