var
s:array [1..30]of integer;
v:array [1..30]of boolean;
n,i,j,z,k,ans:longint;
procedure srch(c:longint);
var i,j,tp:longint;
begin
v[c]:=true;
s[z]:=c;
inc(z);
if z>=n+1 then
begin
tp:=0;
for i:=1 to n do
if s[i]>s[i+1] then inc(tp);
if tp=k then inc(ans);
end
else
for i:=1 to n do
if (not v[i]) and(i<>c) then
begin
v[i]:=true;
srch(i);
end;
dec(z);
v[c]:=false;
end;
begin
assign(input,'k.in');
reset(input);
assign(output,'k.out');
rewrite(output);
readln(n,k);
z:=1;
FillChar(v, sizeof(v), 0);
for j:=1 to n do
if not v[j] then
srch(j);
writeln(ans);
close(input);
close(output);
end.