from sys import stdin def main(): input = lambda: stdin.readline()[:-1] A, B = map(int, input().split()) if (A > 0 and B > 0) or (not A and B != 0): print(-1) return elif A == B == 0: print(1) return ans = abs(B // A) if ans % 2: print(-1) else: print(max(1, ans)) main()