#include <bits/stdc++.h>
using namespace std;
const int MOD = 1e9 + 7;
long long n, k;
long long f(long long n) {
  if (n == 1) return 1;
  long long res = n;
  for (long long m = 2; m * m <= n; ++m)
    if (n % m == 0) {
      res = res / m * (m - 1);
      while (n % m == 0) n /= m;
    }
  if (n > 1) res = res / n * (n - 1);
  return res;
}
int main() {
  cin >> n >> k;
  long long res = n;
  for (int i = 1; i <= ((k + 1) >> 1) && res > 1; ++i) res = f(res);
  cout << (res % MOD);
  return 0;
}
