INF = float("inf") ans = INF MAX = 10 def f(x, y, cnt): if x == y: global ans if ans > MAX - cnt: ans = MAX - cnt return if cnt < 0: return cnt -= 1 f(y, x, cnt) f(x + y, x - y, cnt) x, y = map(int, input().split()) f(x, y, MAX) print(ans if ans != INF else -1)