#include <bits/stdc++.h>
using namespace std;
const int M = 1e9 + 7;
long long n, k;
long long fi(long long x) {
  long long d = 2, res = 1, cp = x;
  while (d * d <= cp) {
    long long p = 1;
    while (x % d == 0) x /= d, p *= d;
    res *= p - p / d;
    d++;
  }
  if (x > 1) res *= x - 1;
  return res;
}
int main() {
  cin >> n >> k;
  k = (k + 1) / 2;
  while (k-- && n > 1) n = fi(n);
  cout << n % M << "\n";
  return 0;
}
