#include <bits/stdc++.h>
using namespace std;
inline long long rd() {
  long long x = 0, f = 1;
  char c = getchar();
  while (!isdigit(c)) {
    if (c == '-') f = -1;
    c = getchar();
  }
  while (isdigit(c)) x = x * 10 + c - '0', c = getchar();
  return x * f;
}
long long phi(long long n) {
  long long ans = n;
  for (long long i = 2; i * i <= n; i++) {
    if (n % i == 0) {
      while (n % i == 0) n /= i;
      ans = ans / i * (i - 1);
    }
  }
  if (n != 1) ans = ans / n * (n - 1);
  return ans;
}
long long n, k;
int main() {
  n = rd(), k = (rd() + 1) / 2;
  while (k--) {
    n = phi(n);
    if (n == 1) break;
  }
  cout << n % 1000000007;
  return 0;
}
