program bly(input,output);
var
f1,f2:text;
l,ans,n,p,i:longint;
begin
assign(f1,'subway.in');
assign(f2,'subway.out');
reset(f1);
rewrite(f2);
readln(f1,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(f2,ans);
close(f1);
close(f2);
end.