#include <bits/stdc++.h>
const int MAXN = 1000005, MAXP = 100005;
bool isprime[MAXN];
int prime[MAXP];
using namespace std;
void calc_prime(int n) {
  memset(isprime, true, sizeof isprime);
  for (int i = 2; i <= n; i++) {
    if (isprime[i]) prime[++prime[0]] = i;
    for (int j = 1; j <= prime[0]; j++) {
      if (i * prime[j] > n) break;
      isprime[i * prime[j]] = false;
      if (i % prime[j] == 0) break;
    }
  }
}
long long phi(long long x) {
  long long ret = x;
  for (int i = 1; i <= prime[0] && (long long)prime[i] * prime[i] <= x; i++) {
    if (x % prime[i] == 0) ret = ret / prime[i] * (prime[i] - 1);
    while (x % prime[i] == 0) x /= prime[i];
  }
  if (x > 1) ret = ret / x * (x - 1);
  return ret;
}
int main() {
  calc_prime(1000000);
  long long n, k;
  scanf("%lld%lld", &n, &k);
  long long ans = n;
  for (long long i = 1; i <= k; i += 2) {
    ans = phi(ans);
    if (ans == 1) break;
  }
  printf("%lld\n", ans % 1000000007);
  return 0;
}
