{Ilian Ivanov, C.gr, MG'Baba Tonka}
var
k,i:integer;
j,t,p:longint;
mas:array[1..32000]of integer;
{*************}
function proiz(a:longint):longint;
var
flag:byte;
j,r:longint;
begin
if a=1
   then proiz:=0
   else if mas[a]=a
        then proiz:=1
        else begin
             flag:=0;
             j:=1;
             while flag=0 do
                   begin
                   inc(j);if a mod j=0 then flag:=1;
                   end;
             r:=a div j;
             proiz:=proiz(j)*r+j*proiz(r);
             end;
end;
{*************}
begin
readln(p,k);
{*************}
for i:=1 to 32000 do mas[i]:=i;
for i:=2 to 16000 do
    if mas[i]<>0
    then
    begin
    j:=i;
    while j<32000 do
          begin
          j:=j+i;
          if j<=32000
          then mas[j]:=0;
          end;
    end;
{*************}
t:=p;
for i:=1 to k do
t:=proiz(t);
writeln(t);
end.

