class PrimeNumbers: def __init__(self,nmax): from math import isqrt rootnmax = isqrt(nmax) self.prime_judgement = [True]*(rootnmax+1) self.prime_judgement[0] = self.prime_judgement[1] = False for i in range(2,rootnmax+1): if self.prime_judgement[i]: for j in range(2,rootnmax//i+1): self.prime_judgement[i*j] = False self.prime_list = [] for i,flag in enumerate(self.prime_judgement): if flag: self.prime_list.append(i) def prime_factorization(self,n): return_list = [] for i in self.prime_list: if n==1 or i*i>n: break if n%i==0: return_list.append([i,0]) while n%i==0: return_list[-1][1] += 1; n //= i if n!=1: return_list.append([n,1]) return return_list from collections import defaultdict n,k = map(int,input().split()) mod = 10**9+7 pn = PrimeNumbers(2*n) c = {p:q for p,q in pn.prime_factorization(n)} for i in range(k): d = defaultdict(int) for p,q in c.items(): for x,y in pn.prime_factorization(p+1): d[x] += y*q c = d if (k-i)%2==0 or set(c.keys())-{2,3}: continue r = pow(2,(k-i)//2,mod-1) exit(print(pow(2,c[2]*r,mod)*pow(3,c[3]*r,mod)%mod)) ans = 1 for p,q in c.items(): ans *= pow(p,q,mod) print(ans%mod)