#include <bits/stdc++.h>
using namespace std;
long long phi(long long x);
const long long mod = 1e9 + 7;
int main() {
  long long N, K;
  cin >> N >> K;
  while (K > 0 && N > 1) {
    N = phi(N);
    K -= 2;
  }
  cout << N % mod << endl;
}
long long phi(long long x) {
  int R = sqrt(x);
  long long ans = 1;
  for (int p = 2; p <= R; ++p) {
    if (x % p == 0) {
      long long curr = 1;
      while (x % p == 0) {
        curr *= p;
        x /= p;
      }
      ans *= (curr - curr / p);
    }
  }
  if (x > 1) {
    ans *= (x - 1);
  }
  return ans;
}
