const MAX = 2000;
type OGR = 1..MAX;
var m,n,i,j : OGR;
    fn,fm:longint;
begin
  read(n,m);
  fn:=1;
  fm:=1;
  case m of
  1: begin for i:= 1 to (n-1) do
             fn:=fn*i;
           writeln(fn mod 1020847);
     end
  else begin for i:= 1 to n do
               fn:=fn*i;
             for i:= 1 to m do
               fm:=fm*i;
       write(round((2*fn*m)/(fm*n)) mod 1020847);
       end;
  end;
end.