#include <bits/stdc++.h>
using LL = long long;
const LL P = 1000000007;
LL n = 0, k = 0;
LL phi(LL x) {
  LL ans = 1;
  for (LL i = 2; i * i <= x; i++) {
    if (!(x % i)) {
      x /= i;
      ans *= i - 1;
      while (!(x % i)) x /= i, ans *= i;
    }
  }
  if (x != 1) ans *= x - 1;
  return ans;
}
int main() {
  scanf("%I64d%I64d", &n, &k);
  for (; k >= 1 && n != 1; k -= 2) n = phi(n);
  printf("%I64d\n", n % P);
  return 0;
}
