#include <bits/stdc++.h>
using namespace std;
long long MOD = 1000000007;
int a[1000006];
int main(void) {
  long long N, k;
  scanf("%I64d %I64d", &N, &k);
  k = (k + 1) / 2;
  vector<long long> primes;
  for (long long i = 2; i < 1000006; i++) {
    if (a[i] == 0) {
      primes.push_back(i);
      long long j = 2 * i;
      while (j < 1000005) {
        a[j] = 1;
        j += i;
      }
    }
  }
  for (long long i = 1; i <= k; i++) {
    if (N == 1) {
      break;
    }
    long long j;
    long long res = 1;
    for (j = 0; primes[j] * primes[j] <= N; j++) {
      if (N % primes[j] == 0) {
        res *= (primes[j] - 1);
        N /= primes[j];
        while ((N % primes[j]) == 0) {
          res *= primes[j];
          N /= primes[j];
        }
      }
    }
    if (N > 1) res *= (N - 1);
    N = res;
  }
  printf("%I64d\n", (N % MOD));
  return 0;
}
