#include <bits/stdc++.h>
using namespace std;
vector<long long> primes;
bitset<1000005> pr;
void sieve() {
  pr.set();
  pr[0] = 0;
  pr[1] = 0;
  for (long long i = 2; i < 1000005; i++) {
    if (pr[i]) {
      for (long long j = i * i; j < 1000005; j += i) pr[j] = false;
      primes.push_back(i);
    }
  }
}
int main() {
  sieve();
  long long int n, k;
  scanf("%I64d%I64d", &n, &k);
  for (long long i = 0; i < (k + 1) / 2; i++) {
    long long tmp = n;
    for (int j = 0; j < primes.size(); j++) {
      if (primes[j] > tmp) break;
      if (tmp % primes[j] == 0) {
        while (tmp % primes[j] == 0) {
          tmp /= primes[j];
        }
        n /= primes[j];
        n *= (primes[j] - 1);
      }
    }
    if (tmp != 1) {
      n /= tmp;
      n *= (tmp - 1);
    }
    if (n == 1) break;
  }
  printf("%I64d\n", n % 1000000007LL);
}
