#include <bits/stdc++.h>
using namespace std;
long long calc(long long n) {
  long long ret = n;
  for (long long i = 2; i * i <= n; i++)
    if (n % i == 0) {
      ret -= ret / i;
      while (n % i == 0) n /= i;
    }
  if (n > 1) ret -= ret / n;
  return ret;
}
long long n, k;
int main() {
  while (~scanf("%lld%lld", &n, &k)) {
    k = (k + 1) / 2;
    while (k-- && n > 1) n = calc(n);
    printf("%lld\n", n % 1000000007);
  }
  return 0;
}
