program subway;
var
fin,fout:text;
l,ans,n,p,i:longint;
begin
assign(fin,'subway.in');
assign(fout,'subway.out');
reset(fin);
rewrite(fout);
readln(fin,n,p);
ans:=1;
if p>=n then
for i:=1 to n do ans:=ans*i mod 4096
else if p<>1 then
begin
for i:=1 to p do ans:=ans*i mod 4096;
for i:=1 to n-p do ans:=ans*2 mod 4096;
end;
writeln(fout,ans);
close(fin);
close(fout);
end.