#include <bits/stdc++.h>
using namespace std;
const long long MD = 1e9 + 7;
long long n, k;
void enter() { cin >> n >> k; }
long long phi(long long x) {
  long long ret = 1;
  for (long long i = 2; i * i <= x; ++i)
    if (x % i == 0) {
      long long tmp = 1, d = i;
      while (x % d == 0) {
        x /= d;
        tmp = tmp * d;
      }
      tmp /= d;
      ret = ret * (d - 1) * tmp;
    }
  if (x > 1) {
    ret = ret * (x - 1);
  }
  return ret;
}
void process() {
  k = (k + 1) / 2;
  while (k > 0) {
    n = phi(n);
    --k;
    if (n == 1) break;
  }
  cout << n % MD << '\n';
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  enter();
  process();
  return 0;
}
