#include <bits/stdc++.h>
using namespace std;
long long n, k;
void init() {
  cin >> n >> k;
  k = (k + 1) / 2;
}
vector<pair<long long, int> > v[2];
vector<pair<long long, int> > decomp(long long x,
                                     vector<pair<long long, int> > &vv) {
  for (long long i = 2; i * i <= x; i++) {
    if (x % i == 0) {
      int ct = 0;
      while (x % i == 0) ct++, x /= i;
      vv.emplace_back(i, ct);
    }
  }
  if (x > 1) vv.emplace_back(x, 1);
  return vv;
}
void process() {
  decomp(n, v[0]);
  int now = 0, nxt = 1;
  for (int qq = 0; qq < k; qq++) {
    v[nxt].clear();
    for (pair<long long, int> pr : v[now]) {
      long long aa = pr.first;
      int bb = pr.second;
      decomp(aa - 1, v[nxt]);
      if (bb > 1) v[nxt].emplace_back(aa, bb - 1);
    }
    sort(v[nxt].begin(), v[nxt].end());
    v[now].clear();
    for (pair<long long, int> pr : v[nxt]) {
      long long aa = pr.first;
      int bb = pr.second;
      if (aa == 1 || bb == 0) continue;
      if (v[now].size() && aa == v[now].back().first)
        v[now].back().second += bb;
      else
        v[now].push_back(pr);
    }
    if (v[now].size() == 0) break;
  }
  long long ans = 1;
  for (pair<long long, int> pr : v[now]) {
    long long aa = pr.first;
    int bb = pr.second;
    for (int t = 0; t < bb; t++) {
      ans = ans * aa % 1000000007;
    }
  }
  cout << ans << endl;
}
int main() {
  init();
  process();
  return 0;
}
