#include <bits/stdc++.h>
using namespace std;
long long Phi(long long n) {
  if (n == 1) return 1;
  long long result = n;
  for (long long p = 2; p * p <= n; ++p) {
    if (n % p == 0) {
      while (n % p == 0) n /= p;
      result -= result / p;
    }
  }
  if (n > 1) result -= result / n;
  return result;
}
const int MOD = 1000000007;
int main() {
  ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  long long n, k;
  cin >> n >> k;
  long long result = Phi(n);
  for (long long i = 3; i <= k && result > 1; i += 2) {
    result = Phi(result);
  }
  cout << result % MOD;
  return 0;
}
