#include<iostream.h>
#include<conio.h>
int del1,del2;
int simple(int a) {
    int yes=1;
    for (int i=2;i<a;i++) {
        if (a%i==0) yes=0;
    }
    return yes;
}
int deliteli(int a) {
    for (int i=2;i<a;i++) {
        if (a%i==0) {del1=i;del2=a/i;return 0;}
    }
    return 0;
}
int deriv (int a) {
    if (a==0) return 0;
    if (simple(a)) return 1;
    deliteli(a);
    return deriv(del1)*del2+del1*deriv(del2);
}
int main() {
    clrscr();
    int p,k,number;
    cin >> p >> k;
    while(p<0||k<0||p>1000||k>10) {
         cout << "k trqbva da e <= 10 i >= 0!\np trqbva da e <= 1000 i >= 0!\n";
         cin >> p >> k;
    }
    number=p;
    for (int i=0;i<k;i++) {
        number=deriv(number);
    }
    cout << number;
    getch();
    return 0;
}