#include <bits/stdc++.h>
using namespace std;
long long int n, k, an;
long long int totient(long long int num) {
  if (num == 1) return 1;
  long long int tmp = num;
  for (long long int i = 2; i * i <= num; i++) {
    if (num % i == 0) {
      while (num % i == 0) num /= i;
      tmp -= tmp / i;
    }
  }
  if (num > 1) tmp -= tmp / num;
  return tmp;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  ;
  scanf("%lld%lld", &n, &k);
  long long int bef = -1;
  for (int i = 1; i <= k; i += 2) {
    n = totient(n);
    if (n == bef) break;
    bef = n;
  }
  n = n % 1000000007;
  printf("%lld", n);
  return 0;
}
