#include <bits/stdc++.h>
using namespace std;
int gcd(int a, int b) {
  while (a > 0) {
    b %= a;
    swap(a, b);
  }
  return b;
}
int f(int n) {
  if (n == 1) return 1;
  int res = 0;
  for (int i = 1; i < n; i++)
    if (gcd(i, n - i) == 1) res++;
  return res;
}
int g(int n) {
  int res = 0;
  for (int d = 1; d <= n; d++)
    if (n % d == 0) res += f(n / d);
  return res;
}
int F(int n, int k) {
  if (k == 1) return f(g(n));
  if (k % 2 == 0)
    return g(F(n, k - 1));
  else
    return f(F(n, k - 1));
}
const int MOD = 1000000007;
long long phi(long long n) {
  long long result = n;
  for (long long i = 2; i * i <= n; ++i)
    if (n % i == 0) {
      while (n % i == 0) n /= i;
      result -= result / i;
    }
  if (n > 1) result -= result / n;
  return result;
}
long long fast(long long n, long long k) {
  while (k > 0 && n > 1) {
    n = phi(n);
    k -= 2;
  }
  return n;
}
void solve() {
  long long n, k;
  cin >> n >> k;
  cout << fast(n, k) % MOD << endl;
}
int main() {
  solve();
  (void)0;
  return 0;
}
