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 = {k:v for k,v 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; ans = 1 if (k-i)%2==0 or set(c.keys())-{2,3}: continue if 2 in c: ans *= (pow(2,c[2]*pow(2,(k-i)//2,mod),mod)) if 3 in c: ans *= (pow(3,c[3]*pow(2,(k-i)//2,mod),mod)) exit(print(ans%mod)) ans = 1 for p,q in c.items(): ans *= pow(p,q,mod) print(ans%mod)