#include <bits/stdc++.h>
#pragma warning(disable : 4786)
#pragma warning(disable : 4996)
using namespace std;
int gcd(int a, int b) {
  if (a % b == 0) return b;
  return gcd(b, a % b);
}
int f(int n) {
  if (n == 1) return 1;
  int cnt = 0;
  for (int i = 1; i < n; i++) {
    if (gcd(i, n - i) == 1) cnt++;
  }
  return cnt;
}
int g(int n) {
  int ans = 0;
  for (int d = 1; d <= n; d++) {
    if (n % d) continue;
    ans += f(n / d);
  }
  return ans;
}
long long int phi(long long int n) {
  long long int ret = n;
  for (long long int i = 2; i * i <= n; i++) {
    if (n % i) continue;
    ret /= i;
    ret *= i - 1;
    while (n % i == 0) n /= i;
  }
  if (n > 1) {
    ret /= n;
    ret *= n - 1;
  }
  return ret;
}
int main() {
  long long int n, k;
  scanf("%I64d %I64d", &n, &k);
  for (int i = 1; i <= (k + 1) / 2; i++) {
    if (n == 1) break;
    n = phi(n);
  }
  n %= 1000000007;
  printf("%I64d\n", n);
  return 0;
}
