#include <bits/stdc++.h>
using namespace std;
const double eps = 1e-8;
const int inf = 0x7f7f7f7f;
const int N = 1e5 + 5;
const int mod = 1e9 + 7;
long long phi(long long n) {
  long long ret = n;
  for (long long i = 2; i * i <= n; ++i) {
    if (n % i == 0) {
      ret = ret - ret / i;
      while (n % i == 0) n /= i;
    }
  }
  if (n > 1) ret = ret - ret / n;
  return ret;
}
int main() {
  long long n, k;
  scanf("%I64d%I64d", &n, &k);
  long long f = phi(n);
  for (int i = 2; i <= k && f > 1; i++) {
    if (i & 1) {
      f = phi(f);
    }
  }
  printf("%I64d\n", f % mod);
  return 0;
}
