var
   a : array[1..200,1..2000] of longint;
   n,k,i,j : longint;
begin
   readln(n,k);
   for i:=1 to n do
      begin
         a[i,1]:=1;
         a[i,i]:=1;
      end;
   if k>n div 2 + n mod 2 then k:=n-k+1;
   for i:=3 to n do
      begin
         for j:=2 to i div 2 + i mod 2 do
            begin
               a[i,j]:=a[i-1,j-1]*(i-j+1) + a[i-1,j]*j;
               if a[i,j]>1020847 then a[i,j]:=a[i,j] mod 1020847;
               a[i,n-j+1]:=a[i,j];
            end;
      end;
   writeln(a[n,k]);
end.
