n,m=map(int,input().split()) count=0 while 1: count+=1 if n<=m: print(count) break a=n//2 b=n-a if a%2 or b%2: print(-1) break n=a