#include <bits/stdc++.h>
using namespace std;
bitset<1000100> vis;
int p[100010], cnt;
void get_prime() {
  for (int i = 2; i < 1000100; i++) {
    if (vis[i]) continue;
    p[cnt++] = i;
    if (i > 10000) continue;
    for (int j = i * i; j < 1000100; j += i) vis[j] = true;
  }
}
long long phi(long long x) {
  long long y = x;
  for (int i = 0; i < cnt; i++) {
    if (p[i] > sqrt(x)) break;
    if (x % p[i] == 0) {
      y /= p[i];
      y *= (p[i] - 1);
      while (x % p[i] == 0) x /= p[i];
    }
  }
  if (x > 1) {
    y /= x;
    y *= (x - 1);
  }
  return y;
}
long long n, k;
const int mod = 1e9 + 7;
int main() {
  get_prime();
  scanf("%I64d %I64d", &n, &k);
  for (long long step = 1; step <= k; step++)
    if (step & 1) {
      n = phi(n);
      if (n == 1) break;
    }
  n %= mod;
  cout << n << endl;
}
