#include <bits/stdc++.h>
using namespace std;
const int inf = 1e9 + 10;
const long long INF = 1e18 + 10;
const int mod = 1e9 + 7;
const char nl = '\n';
bool ispow2(int i) { return i && (i & -i) == i; }
long long phi(long long n) {
  long long i, res = n;
  for (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() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int tc = 1;
  while (tc--) {
    long long n, k, res;
    cin >> n >> k;
    res = n;
    k = (k + 1) / 2;
    while (k--) {
      res = phi(res);
      if (res == 1) break;
    }
    cout << res % mod;
  }
  return 0;
}
