#include <bits/stdc++.h>
using namespace std;
long long read() {
  long long x = 0, w = 0;
  char ch = 0;
  while (!isdigit(ch)) {
    w |= ch == '-';
    ch = getchar();
  }
  while (isdigit(ch)) {
    x = (x << 3) + (x << 1) + ch - '0';
    ch = getchar();
  }
  return w ? -x : x;
}
long long n, k;
const int mod = 1000000007;
long long phi(long long n) {
  long long ans = n;
  for (long long i = 2; i * i <= n; ++i)
    if (n % i == 0) {
      ans -= ans / i;
      while (n % i == 0) n /= i;
    }
  return ans - (n > 1 ? ans / n : 0);
}
int main() {
  n = read(), k = read();
  ++((++k) >>= 1);
  while (--k && n > 1) n = phi(n);
  cout << n % mod;
  return 0;
}
