uses crt;var m,n:longint;beginread(m,n);if (m mod n=0) or (n mod m=0) then writeln(1)else writeln(2);end.
uses crt;
var m,n:longint;
begin
read(m,n);
if (m mod n=0) or (n mod m=0) then writeln(1)
else writeln(2);
end.