mod = 10**9+7 n,k = map(int, input().split()) m = 10**5+100 a = [-1] * m p = [] d = dict() for i in range(2, m): if a[i] == -1: d[i] = len(p) p.append(i) for j in range(i, m, i): a[j] = i pl = len(p) from collections import defaultdict def f(x): res = defaultdict(int) while x != 1: q = a[x] c = 0 while x % q == 0: x //= q c += 1 res[q] = c return res def g(a, b, k): if k % 2 == 0: return pow(2, pow(2, k//2, mod-1)*a, mod)*pow(3, pow(2, k//2, mod-1)*b, mod)%mod else: return pow(2, pow(2, (k+1)//2, mod-1)*b, mod)*pow(3, pow(2, k//2, mod-1)*a, mod)%mod b = [] for q in p: if q < 10**5+10: b.append(f(q+1)) c = f(n) for i in range(k): if len(c) <= 2 and sum([x == 2 or x == 3 for x in c]) == len(c): print(g(c[2], c[3], k-i)) exit() nxt = defaultdict(int) for q in c: for r in b[d[q]]: nxt[r] += b[d[q]][r] * c[q] c = nxt #print(c) ans = 1 for i in c: ans *= pow(i, c[i], mod) ans %= mod print(ans)