#include using namespace std; #define all(x) (x).begin(), (x).end() #define rep(i, n) for(ll i=0; i<(ll)(n); i++) template bool chmax(T& a, T b) { return a bool chmin(T& a, T b) { return a>b ? a=b, true : false; } using ll=long long; const int INF=1e9+10; const ll INFL=4e18; using VI=vector; using VVI=vector; using VL=vector; using VVL=vector; using PL=pair; using VP=vector; using WG=vector>>; #ifdef LOCAL #include "./debug.hpp" #else #define debug(...) #define print_line #endif /// @brief x^n (mod m) を返す template T ModPow(T x, T n, T mod) { T ret=1; if(typeid(T)==typeid(ll)&&mod>INF*2) return ModPow<__int128_t>(x,n,mod); while(n>0) { if(n&1) (ret*=x)%=mod; (x*=x)%=mod; n>>=1; } return ret; } /// @brief x^(-1) (mod m) を返す ll ModInv(ll a, ll m) { ll b=m,u=1,v=0; while(b) { ll t=a/b; a-=t*b; swap(a,b); u-=t*v; swap(u,v); } return (u+m)%m; } //---------------------------------------------------------- void solve() { ll N,M; cin>>N>>M; VL A(N); rep(i,N) A[i]=ModPow(i,M,N); sort(all(A)); A.erase(unique(all(A)),A.end()); puts(A.size()==N?"Yes":"No"); } int main() { ios::sync_with_stdio(false); cin.tie(nullptr); //cout<>T; while(T--) solve(); }