#include <bits/stdc++.h>
using namespace std;
void FREOPEN() {
  freopen(
      ""
      ".in",
      "r", stdin);
  freopen(
      ""
      ".out",
      "w", stdout);
}
inline double Time() { return (clock() * 1.0) / CLOCKS_PER_SEC; }
const int N = 200500, inf = 1e9 * 2, MOD = 1e9 + 7;
char CH[N];
const long long INF = 1e18;
const int dx[] = {1, -1, 0, 0, -1, 1, -1, 1};
const int dy[] = {0, 0, 1, -1, -1, 1, 1, -1};
long long first(long long n) {
  long long ret = 1;
  long long last = n;
  for (long long i = 2; i * 1ll * i <= n; i++) {
    if (n % i) continue;
    last /= i;
    ret *= i - 1;
    while (n % i == 0) n /= i;
  }
  if (n > 1) {
    ret *= n - 1;
    last /= n;
  }
  ret *= last;
  return ret;
}
int main() {
  long long n, k;
  cin >> n >> k;
  k = (k + 1) / 2;
  while (n > 1 && k--) {
    n = first(n);
  }
  cout << n % MOD;
  return 0;
}
