program march;
var
  N,P,i:longword;
  res:longword;

function lnp(pN,pP:longword):longword;
var
  j:word;
  temp:longword;
begin
  temp:=1;

  for j:=(pP+1) to pN do
    temp := temp * j;

  if (pP>0) then
  for j:=2 to (pN-pP) do
    temp := temp div j;

  lnp:=temp;
end;

begin
  readln(N,P);
  res:=1;
  for i:=1 to P do
  begin
    res := res * lnp(N-i,P-i);
    res := res mod 1020847;
  end;
  writeln(res);
end.
