A, B = map(int, input().split()) if B == 0: print(1) else: if A != -1: print(-1) else: print(2)