#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
#pragma GCC optimization("unroll-loops")
const int N = 2e5 + 5;
const long long int mod = 1e9 + 7;
const long long int Mod = 998244353;
const long double Pi = acos(-1);
const long long int Inf = 4e18;
int dx[9] = {0, 1, -1, 0, 0, 1, 1, -1, -1};
int dy[9] = {0, 0, 0, 1, -1, 1, -1, 1, -1};
using namespace std;
void TestCase() {
  long long int n, k, cur;
  cin >> n >> k;
  cur = n;
  for (long long int i = 1; i <= (k + 1) / 2; i++) {
    if (cur == 1)
      break;
    else {
      set<long long int> push_front;
      long long int x = cur, div;
      while (x > 1) {
        div = -1;
        if (x % 2 == 0)
          div = 2;
        else {
          for (long long int j = 3; j * j <= x; j += 2) {
            if (x % j == 0) {
              div = j;
              break;
            }
          }
          if (div == -1) div = x;
        }
        push_front.insert(div);
        x = x / div;
      }
      for (auto &o : push_front) cur = (cur / o) * (o - 1);
    }
  }
  cout << cur % mod;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  ;
  int T = 1;
  while (T--) {
    TestCase();
    cout << "\n";
  }
  return 0;
}
