{
Problem:
Arithmetic Analysis:
Writer:
Data:
Remark:
AC:
}
program permutation;
const
filename='permutation';
maxn=100;
var
n,m,ans,step:longint;
vis:array[0..maxn] of boolean;
path:array[0..maxn] of longint;
procedure check;
var
i,tot:longint;
begin
tot:=0;
for i:=1 to n-1 do
if path[i]<path[i+1] then
inc(tot);
if tot=m then ans:=(ans+1) mod 2007;
end;
procedure dfs(x:longint);
var
i:longint;
begin
inc(step);
vis[x]:=true;
path[step]:=x;
if step=n then check;
for i:=1 to n do
if not vis[i] then
dfs(i);
dec(step);
vis[x]:=false;
end;
procedure solve;
var
i:longint;
begin
while not eof do
begin
readln(n,m);
ans:=0;
for i:=1 to n do
begin
step:=0;
dfs(i);
end;
writeln(ans);
end;
end;
begin
assign(input,filename+'.in'); reset(input);
assign(output,filename+'.out'); rewrite(output);
solve;
close(input); close(output);
end.