X,Y=map(int,input().split()) ANS=0 while X!=Y: if X10**5: print(-1) exit() print(ANS)