#include<stdio.h>
#include<math.h>
int prosto(unsigned long ch){
unsigned long i;
for(i=2;i<=sqrt(ch);i++)
if(ch%i==0)return 0;
return 1;
}

unsigned long pr(unsigned long p){
unsigned long a,b,i;
if(p==1)return 0;
if(prosto(p))return 1;
/***************************/
for(i=2;i<=sqrt(p);i++){
  if(p%i==0){a=i;b=p/i;}}
/***************************/
p=a*pr(b)+b*pr(a);
return p;
}
int main(){
unsigned long p;int k,i;
scanf("%lu %d",&p,&k);
for(i=0;i<k;i++){
p=pr(p);
}
printf("%lu\n",p);
return 0;
}
