#include <bits/stdc++.h>
using namespace std;
double PI = acos(-1);
double EPS = 1e-7;
int INF = 1000000000;
long long INFLL = 1000000000000000000LL;
int mx[8] = {-1, 1, 0, 0, -1, -1, 1, 1};
int my[8] = {0, 0, -1, 1, -1, 1, -1, 1};
long long f(long long n) {
  if (n == 0) return 0;
  long long ans = n;
  for (long long x = 2; x * x <= n; ++x) {
    if (n % x == 0) {
      ans -= ans / x;
      while (n % x == 0) n /= x;
    }
  }
  if (n > 1) ans -= ans / n;
  return ans;
}
int main() {
  long long n, k;
  cin >> n >> k;
  k = (k - 1) / 2 + 1;
  while (k-- && n > 1) {
    n = f(n);
  }
  cout << n % 1000000007 << endl;
}
