{Tzolo Atanasov Tzolov 9v PMG Vasil Levski Smolian}
program deriv;
var p,k,i:integer;

function f(p:integer;var a,b:integer):boolean;
begin
if (p=2) or (p=3) then
                  begin
                  a:=1;
                  b:=p;
                  f:=false
                  end
else if p mod 2 = 0 then
   begin
   a:=2;
   b:=p div 2;
   f:=true
   end
else begin
     a:=3;
     while (p mod a = 0) and (a<=sqrt(p)) do
        a:=a+2;
     if p mod a =0 then
          begin
          f:=true;
          b:=p div a
          end
       else
         begin
         a:=1;
         b:=p;
         f:=false;
         end;
     end;
end;
function r(p:integer):integer;
var a,b:integer;
begin
if p=1 then r:=0
   else if  not f(p,a,b)  then r:=1
        else r:=r(a)*b+a*r(b);

end;

BEGIN
readln(p,k);
for i:=1 to k do

begin
p:=r(p);
end;
writeln(p);
readln
END.
