main=do[a,b]<-map read.words<$>getLine;print$if b`mod`a==0 then b`div`a else(-1)