X,Y = map(int, input().split()) if X == Y: ans = 0 elif Y == 0: ans = 1 elif X == 0: ans = 2 else: ans = -1 print(ans)