#include <bits/stdc++.h>
using namespace std;
unsigned long long totient(unsigned long long n) {
  unsigned long long res = n;
  for (unsigned long long i = 2; i * i <= n; i++) {
    if (n % i == 0) {
      while (n % i == 0) n /= i;
      res -= res / i;
    }
  }
  if (n > 1) res -= res / n;
  return res;
}
int main() {
  unsigned long long n, k, res;
  scanf("%lld", &n), scanf("%lld", &k);
  res = n;
  k = (k + 1) / 2;
  while (k) {
    res = totient(res);
    if (res == 1) break;
    k--;
  }
  cout << res % 1000000007;
  return 0;
}
