#include <bits/stdc++.h>
using namespace std;
const int INF = 1 << 30;
const int N = 1e7;
const int MOD = 1e9 + 7;
bool flag[N];
vector<int> prime;
int phi[N];
void prime_gen_linear() {
  phi[1] = 1;
  for (int i = 2; i < N; ++i) {
    if (!flag[i]) {
      prime.push_back(i);
      phi[i] = i - 1;
    }
    for (int j = 0, k; j < prime.size() && (k = prime[j] * i) < N; ++j) {
      flag[k] = true;
      if (i % prime[j] == 0)
        phi[k] = prime[j] * phi[i];
      else
        phi[k] = phi[i] * (prime[j] - 1);
      if (i % prime[j] == 0) break;
    }
  }
}
long long calc(long long n) {
  if (n < N) return phi[n];
  long long ret = 1;
  for (auto& p : prime) {
    if ((long long)p * p > n) break;
    if (n % p == 0) {
      long long prod = p - 1;
      n /= p;
      while (n % p == 0) {
        n /= p;
        prod *= p;
      }
      ret *= prod;
    }
    if (n < N) return ret * phi[n];
  }
  if (n > 1) {
    ret *= n - 1;
  }
  return ret;
}
long long solve(long long n, long long k) {
  if (n == 1) return 1;
  if (k == 0) return calc(n);
  return solve(calc(n), k - 1);
}
int main() {
  prime_gen_linear();
  long long n, k;
  scanf("%lld%lld", &n, &k);
  k = (k - 1) / 2;
  printf("%lld\n", solve(n, k) % MOD);
  return 0;
}
