#include <bits/stdc++.h>
using namespace std;
template <class T>
struct rge {
  T b, e;
};
template <class T>
rge<T> range(T i, T j) {
  return rge<T>{i, j};
};
template <class A, class B>
ostream &operator<<(ostream &os, pair<A, B> p) {
  return os << "(" << p.first << ", " << p.second << ")";
}
template <class T>
ostream &operator<<(ostream &os, rge<T> d) {
  os << "[";
  for (auto it = d.b; it != d.e; it++) os << (it == d.b ? "" : ", ") << *it;
  return os << "]";
}
const int N = 1e6 + 5;
const long long mod = 1e9 + 7;
bool isp[N];
vector<long long> p;
long long phi(long long n) {
  long long r = n;
  for (long long x : p) {
    if (1LL * x * x > n) {
      break;
    }
    if (n % x == 0) {
      r -= r / x;
      while (n % x == 0) {
        n /= x;
      }
    }
  }
  if (n > 1) {
    r -= r / n;
  }
  return r;
}
int main() {
  ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0), cout.precision(15);
  fill_n(isp, N, true);
  for (int i = (1); i <= ((N - 1)); i += (+1))
    if (i > 1) {
      if (isp[i]) {
        p.push_back(i);
        for (int j = (i + i); j <= (N - 1); j += (+i)) {
          isp[j] = false;
        }
      }
    }
  long long n, k;
  cin >> n >> k;
  while (k >= 1 && n > 1) {
    n = phi(n);
    k -= 2;
  }
  cout << n % mod << '\n';
  return 0;
}
