#include <bits/stdc++.h>
using namespace std;
int mod = 10000 * 100000 + 7;
void pairsort(int a[], int b[], int n) {
  pair<int, char> pairt[n];
  for (int i = 0; i < n; i++) {
    pairt[i].first = a[i];
    pairt[i].second = b[i];
  }
  sort(pairt, pairt + n);
  for (int i = 0; i < n; i++) {
    a[i] = pairt[i].first;
    b[i] = pairt[i].second;
  }
}
std::vector<int> decToBinary(int n) {
  int binaryNum[1000];
  std::vector<int> res;
  int i = 0;
  while (n > 0) {
    binaryNum[i] = n % 2;
    n = n / 2;
    i++;
  }
  for (int j = i - 1; j >= 0; j--) {
    res.push_back(binaryNum[j]);
  }
  return res;
}
long long Pow(long long x, long long p) {
  long long res = 1;
  x = x % mod;
  while (p) {
    if (p % 2) res = res * x;
    p >>= 1;
    x = x * x % mod;
    res %= mod;
  }
  return res;
}
bool isPrime(long long int n) {
  if (n == 1 || n == 2) return true;
  for (int i = 2; i <= sqrt(n); i++) {
    if (n % i == 0) return false;
  }
  return true;
}
vector<long long int> findFactors(long long int n) {
  vector<long long int> ans;
  for (int i = 1; i <= sqrt(n); i++) {
    if (n % i == 0) {
      ans.push_back(i);
      if (i * i != n) {
        ans.push_back(n / i);
      }
    }
  }
  return ans;
}
bool isPerfectSquare(long long int x) {
  long double sr = sqrt(x);
  return ((sr - floor(sr)) == 0);
}
vector<long long int> findPrimeFactors(long long int n, bool sq) {
  vector<long long int> ans;
  int root = sqrt(n);
  for (int i = 1; i <= sqrt(n); i++) {
    if (n % i == 0) {
      if (isPrime(i) && i != 1) ans.push_back(i);
      if (!sq || (sq && i != root)) {
        if (isPrime(n / i) && (n / i) != 1) ans.push_back(n / i);
      }
    }
  }
  return ans;
}
long long int f(long long int n, std::vector<long long int> pr) {
  if (n == 1) return 1;
  long long int ans = n;
  for (int i = 0; i < pr.size(); i++) {
    ans /= pr[i];
  }
  for (int i = 0; i < pr.size(); i++) {
    ans *= (pr[i] - 1);
  }
  return ans;
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  long long int n, k;
  cin >> n >> k;
  long long int t = 1;
  long long int ans = n;
  while (t <= k && ans != 1) {
    vector<long long int> prt = findPrimeFactors(ans, isPerfectSquare(ans));
    if (t % 2 != 0) ans = f(ans, prt);
    t++;
  }
  cout << ans % mod << endl;
  return 0;
}
