#include <bits/stdc++.h>
using namespace std;
long long n, k;
long long pow(long long a, int b) {
  if (b == 0) return 1;
  long long base = pow(a, b >> 1);
  base = base * base;
  if (b & 1) base = base * a;
  return base;
}
long long f(long long n) {
  if (n == 1) return 1;
  map<long long, int> factors;
  long long n_ = n;
  for (long long i = 2; i * i <= n_; i++) {
    while (n % i == 0) {
      factors[i]++;
      n /= i;
    }
  }
  if (n > 1) factors[n]++;
  long long ans = 1;
  for (pair<long long, int> p : factors) {
    ans *= pow(p.first, p.second) - pow(p.first, p.second - 1);
  }
  return ans;
}
int main() {
  scanf(" %lld %lld", &n, &k);
  for (int i = 0; i < (k + 1) / 2; i++) {
    n = f(n);
    if (n == 1) break;
  }
  printf("%lld\n", n % 1000000007);
  return 0;
}
