program subway;
const
max=4096;
var
f1,f2:text;
n,p:integer;
ans:longint;
procedure ini;
begin
assign(f1,'subway.in');reset(f1);
assign(f2,'subway.out');rewrite(f2);
readln(f1,n,p);
close(f1);
end;
procedure main;
var
i,j:integer;
begin
ans:=1;
if p>=n then
for i:=1 to n do ans:=(ans*i) mod max
else
if p<>1 then begin
for i:=1 to p do ans:=(ans*i) mod max;
for i:=1 to n-p do ans:=(ans*2) mod max;
end;
end;
begin
ini;
main;
write(f2,ans);
close(f2);
end.