#include using namespace std; #define rep(i,n) for (int i = 0; i < (int)(n); ++i) #define rrep(i,n) for (int i = (int)(n-1); i >= 0; --i) #define Rep(i,a,b) for (int i = a; i < b; ++i) #define rRep(i,a,b) for (int i = a; i > b; --i) #define fore(i,a) for(auto &i:a) #define all(v) (v).begin(),(v).end() #define rall(v) (v).rbegin(),(v).rend() #define Unique(v) v.erase(unique(v.begin(), v.end()), v.end()); #define Bit(x,i) (((x)>>(i))&1) using ll = long long; using vi = vector; using vll = vector; using vvi = vector; using vvll = vector; using vb = vector; using vs = vector; using pii = pair; using pll = pair; templatebool chmax(T &a, const T &b) { if (abool chmin(T &a, const T &b) { if (b= mod) x -= mod; return *this; } modint& operator-=(const modint& a) { if ((x += mod-a.x) >= mod) x -= mod; return *this; } modint& operator*=(const modint& a) { (x *= a.x) %= mod; return *this; } modint operator+(const modint& a) const { modint res(*this); return res+=a; } modint operator-(const modint& a) const { modint res(*this); return res-=a; } modint operator*(const modint& a) const { modint res(*this); return res*=a; } modint pow(ll t) const { if (!t) return 1; modint a = pow(t>>1); a *= a; if (t&1) a *= *this; return a; } modint inv() const { return pow(mod-2); } modint& operator/=(const modint& a) { return (*this) *= a.inv(); } modint operator/(const modint& a) const { modint res(*this); return res/=a; } friend ostream& operator<<(ostream& os, const modint& m){ os << m.x; return os; } }; ll powmod(ll n, ll p, ll m) { if(p == 0) return 1; ll res = powmod(n, p/2, m); n %= m; if(p%2 == 0) return (res*res) % m; return (((res*res) % m)*n) % m; } vector Eratosthenes(int N) { vector is_prime(N+1); for(int i=0; i<=N; ++i) { is_prime[i] = true; } vector ret; for(int i=2; i<=N; ++i) { if(is_prime[i]) { for(int j=2*i; j<=N; j+=i) { is_prime[j] = false; } ret.emplace_back(i); } } return ret; } ll dp[100][10010]; map mp; vector> nx(10010); int main() { ll N, K; cin >> N >> K; vi prm = Eratosthenes(100000); int ps = prm.size(); ll iid = 0; fore(p, prm) { mp[p] = iid; ++iid; } int NN = N; for(int i = 2; i*i <= NN; ++i) { int cnt = 0; while(N % i == 0) { cnt++; N /= i; } dp[0][mp[i]] = cnt; } if(N > 1) dp[0][mp[N]] = 1; rep(i, ps) { int pp = prm[i]+1; int ppp = pp; for(int j = 2; j * j <= ppp; ++j) { int cnt = 0; while(pp % j == 0) { pp /= j; cnt++; } if(cnt > 0) { nx[i].push_back({mp[j], cnt}); } } if(pp > 1) { nx[i].push_back({mp[pp], 1LL}); } } rep(k, 52) { rep(i, ps) { fore(nnx, nx[i]) { dp[k+1][nnx.first] += nnx.second * dp[k][i]; } } } modint ans = 1; if(K < 50) { rep(i, ps) { ans *= powmod(prm[i], dp[K][i], mod); } cout << ans << endl; return 0; } K -= 50; ll two = dp[50][0]; ll thr = dp[50][1]; ll mm = K%2; K /= 2; // 2^(two * 2^K) ll ppow = powmod(2, K, mod-1); // cout << two << ' ' << thr << ' ' << ppow << endl; if(mm) { ans *= powmod(3, two * ppow, mod); ans *= powmod(2, thr * ppow * 2, mod); } else { ans *= powmod(2, two * ppow, mod); ans *= powmod(3, thr * ppow, mod); } cout << ans << endl; /* ll KK = 1000000000000LL; ll pppow = powmod(2, KK/2, mod-1); // 2^2^KK cout << pppow << endl; cout << powmod(2, pppow, mod); */ }