#include <bits/stdc++.h>
using namespace std;
const int mod = 1e9 + 7;
long long n, k;
long long phi(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 = n / i;
      result -= result / i;
    }
  }
  if (n > 1) result -= result / n;
  return result;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin >> n >> k;
  for (long long j = 1; j <= k; j++) {
    if (j % 2 == 1) n = phi(n);
    if (n == 1) break;
  }
  cout << n % mod << "\n";
  return 0;
}
