#include <bits/stdc++.h>
using namespace std;
const long long mod = 1e9 + 7;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  long long n, k;
  cin >> n >> k;
  ++k;
  k >>= 1;
  while (k) {
    if (n == 1) {
      break;
    }
    long long res = n;
    for (long long p = 2; p * p <= n; ++p) {
      if (n % p == 0) {
        res /= p;
        res *= (p - 1);
        while (n % p == 0) {
          n /= p;
        }
      }
    }
    if (n != 1) {
      res /= n;
      res *= (n - 1);
    }
    n = res;
    --k;
  }
  cout << n % mod << "\n";
}
