#include <bits/stdc++.h>
using namespace std;
void log(vector<pair<long long, int>> &fact) {}
void factor(vector<pair<long long, int>> &targ, long long val) {
  for (long long p = 2; p * p <= val; p++) {
    if (val % p) continue;
    int ct = 0;
    while (val % p == 0) {
      val /= p;
      ct++;
    }
    targ.emplace_back(p, ct);
  }
  if (val != 1) targ.emplace_back(val, 1);
}
void cleanup(vector<pair<long long, int>> &fact) {
  sort((fact).begin(), (fact).end());
  vector<pair<long long, int>> res;
  for (auto p : fact) {
    if (!p.second) continue;
    if (res.size() == 0 || res.back().first != p.first)
      res.push_back(p);
    else
      res.back().second += p.second;
  }
  swap(res, fact);
}
void totient(vector<pair<long long, int>> &fact) {
  vector<pair<long long, int>> upd;
  for (auto &p : fact) {
    if (p.second > 1) upd.emplace_back(p.first, p.second - 1);
    factor(upd, p.first - 1);
  }
  cleanup(upd);
  swap(fact, upd);
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0), cout.tie(0);
  cout << fixed << setprecision(15);
  long long N, K;
  cin >> N >> K;
  vector<pair<long long, int>> fact;
  factor(fact, N);
  log(fact);
  for (; K > 0; K--) {
    if (K & 1) {
      totient(fact);
      if (fact.size() == 0) {
        break;
      }
    } else {
    }
    log(fact);
  }
  const int MOD = 1e9 + 7;
  long long res = 1;
  for (auto p : fact) {
    for (int ct = 0; ct < p.second; ct++) res = res * p.first % MOD;
  }
  cout << res << endl;
  return 0;
}
