#include <stdio.h>

long unsigned Deriv(long unsigned num);

int row,j;
long unsigned number;

int main()
{
	scanf("%lu %d",&number,&row);
	for(j=0;j<row;j++)
	number=Deriv(number);
	printf("%lu\n",number);
	return 0;
}
long unsigned Deriv(long unsigned num)
{
	int i;
	long unsigned a,b;
	if(num==1||num==0)return 0;
	for(i=2;i<=num;i++)
	{
		if(num%i==0)
		{
			a=i;
			b=num/i;
			break;
		}
	}
	return b+a*Deriv(b);
}