program Deriv;
 type red=0..10;
 var i,j,p:integer;
     k:red;


function Simple(p:integer):boolean;
 var c:integer;
 begin
  Simple:=true;
  for c:=2 to p-1 do
   if p mod c =0 then Simple:=false;
 end;

function Pro(p:integer):integer;
 var i,j:integer;
 begin
  if p=1 then Pro:=0
   else
    if Simple(p)=true then Pro:=1
     else
       begin
        i:=2;
        while (p mod i <>0) do
         begin
         i:=i+1;
        end;
        Pro:=Pro(i)*(p div i)+(i*Pro(p div i))
       end;
 end;

begin
readln(p,k);
for i:=1 to k do
p:=Pro(p);
writeln(p);
readln;
end.

