#include <bits/stdc++.h>
using namespace std;
const long long mod = 1e9 + 7;
int prime[1000010];
vector<long long> primes;
long long Phi(long long n) {
  long long b = n, ret = n;
  for (int i = 0; i < primes.size(); i++) {
    if (primes[i] * primes[i] > b) {
      break;
    }
    if (b % primes[i]) continue;
    while (b % primes[i] == 0) {
      b /= primes[i];
    }
    ret -= ret / primes[i];
  }
  if (b > 1) ret -= ret / b;
  return ret;
}
int main() {
  memset(prime, 1, sizeof prime);
  prime[1] = 0;
  for (int i = 2; i * i <= 1000000; i++) {
    if (prime[i]) {
      for (int j = i * i; j <= 1000000; j += i) prime[j] = 0;
      primes.push_back(i);
    }
  }
  for (int i = 1001; i <= 1000000; i++)
    if (prime[i]) primes.push_back(i);
  long long n, k;
  cin >> n >> k;
  k = (k + 1) / 2;
  while (k--) {
    n = Phi(n);
    if (n == 1) break;
  }
  cout << n % mod << endl;
  return 0;
}
