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