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