program empire;
var
i,n,k:integer;
l:array [1..200] of record
st,len:integer;
end;
table:array [1..200,1..200] of boolean;
sum:integer;
procedure put(x,k:integer);
var
flag:boolean;
i,j:integer;
begin
if k=0 then sum:=(sum+1) mod 504 else if x<=2*n-1 then begin
for i:=l[x].st to l[x].st+l[x].len-1 do begin
flag:=true;
for j:=l[i].st to l[i].st+l[i].len-1 do if table[j,i] then begin
flag:=false;
break;
end;
table[x,i]:=true;
if flag then put(x+1,k-1);
table[x,i]:=false;
put(x+1,k);
end;
end;
end;
begin
fillchar (table,sizeof(table),0);
assign (input,'empire.in');
reset (input);
readln (n,k);
for i:=1 to n div 2+1 do begin
l[i].len:=2*i-1;l[i].st:=n-i+1;
l[i+(n-i)*2]:=l[i];
end;
l[n].len:=2*n-1;l[n].st:=1;
close (input);
assign (output,'empire.out');
rewrite (output);
put(1,k);
close (output);
end.