#include <bits/stdc++.h>
using namespace std;
const long long mod = 1e9 + 7;
const int MAXX = 2e6 + 10;
long long phi(long long n) {
  long long ret = n;
  for (long long i = 2; i * i <= n; i++) {
    if (n % i == 0) {
      while (n % i == 0) n /= i;
      ret -= ret / i;
    }
  }
  if (n > 1) ret -= ret / n;
  return ret;
}
int main() {
  long long n, k;
  scanf("%lld %lld", &n, &k);
  k = (k + 1) / 2;
  long long ans = n;
  while (k--) {
    ans = phi(ans);
    if (ans == 1) break;
  }
  printf("%lld", ans % mod);
  return 0;
}
