program Project1; {$APPTYPE CONSOLE} var a,b,c,d,k :int64; begin assign (input,'problem.in'); reset(input); readln(input,a,b); close(input); c:=0; d:=0; repeat inc(c); k:= ((c+1)*c) div 2 ; if k mod b=0 then inc(d); until (c=a); assign (output,'problem.out'); rewrite(output); writeln (a); close(output); end.