program ex;
type
ss=array[1..1200]of integer;
var
a:ss;
n,p:integer;
f1,f2:text;
max,t:longint;
procedure init;
begin
assign(f1,'subway.in');
assign(f2,'subway.out');
reset(f1);
rewrite(f2);
readln(f1,n,p);
close(f1);
end;
procedure main;
var
i:integer;
begin
t:=1;
max:=1;
for i:=1 to p do
max:=(max*i)mod 4096;
for i:=1 to n-p do
t:=(t*2)mod 4096;
max:=(max*t)mod 4096;
writeln(f2,max);
end;
procedure main1;
var
i:integer;
begin
max:=1;
for i:=1 to n do
max:=(max*i)mod 4096;
writeln(f2,max);
end;
begin
init;
if p=1 then writeln(f2,'1')
else if p>n then main1
else main;
close(f2);
end.