#include <bits/stdc++.h>
using namespace std;
const long long inf = (long long)1e18;
const long long mod = (long long)1e9 + 7;
const double pi = acos(-1.0);
const double eps = (double)1e-9;
const int dx[] = {0, 0, 1, 0, -1};
const int dy[] = {0, 1, 0, -1, 0};
const int N = 100500;
long long n, k, ans;
inline long long phi(long long x) {
  long long res = x;
  for (long long i = 2; i * i <= x; i++) {
    if (x % i == 0) {
      res -= res / i;
      while (x % i == 0) x /= i;
    }
  }
  if (x != 1) res -= res / x;
  return res;
}
int main() {
  cin >> n >> k;
  ans = phi(n);
  for (long long i = 2; i <= k; i++) {
    if (i & 1) ans = phi(ans);
    if (ans == 1) break;
  }
  cout << ans % mod;
  return 0;
}
