#include using namespace std; using ll = long long; long long intpow(long long a, long long b, int m){ long long ans = 1; while(b){ if(b & 1) (ans *= a) %= m; (a *= a) %= m; b >>= 1; } return ans; } int main(){ ios::sync_with_stdio(false); cin.tie(0); int n, m; cin >> n >> m; vector used(n); used[0] = true; for(int i = 1; i < n; i++){ int r = intpow(i, m, n); if(used[r]){ cout << "No\n"; return 0; } used[r] = true; } cout << "Yes\n"; }