#include <bits/stdc++.h>
using namespace std;
long long f(long long n) {
  long long result = n;
  for (long long i = 2; i * i <= n; i++)
    if (n % i == 0) {
      while (n % i == 0) n /= i;
      result -= result / i;
    }
  if (n > 1) result -= result / n;
  return result;
}
int main() {
  long long n, k;
  cin >> n >> k;
  while (k > 0) {
    n = f(n);
    if (n == 1) break;
    k -= 2;
  }
  cout << n % 1000000007 << endl;
  return 0;
}
