#include <bits/stdc++.h>
using namespace std;
const long long mod = 1000000007;
long long euler(long long n) {
  long long ans = n;
  long long a = n;
  for (long long i = 2; i * i <= a; i++) {
    if (a % i == 0) {
      ans = ans / i * (i - 1);
      while (a % i == 0) a /= i;
    }
  }
  if (a > 1) ans = ans / a * (a - 1);
  return ans;
}
int main() {
  long long n, k;
  scanf("%I64d%I64d", &n, &k);
  long long m = (k + 1) / 2;
  for (long long i = 1; i <= m; i++) {
    n = euler(n);
    if (n == 1) break;
  }
  cout << n % mod << endl;
  return 0;
}
