MOD = 10 ** 9 + 7 INF = 10 ** 15 def main(): X,Y = map(int,input().split()) if X == Y: print(0) elif Y == 0: print(1) elif X == 0: print(2) else: print(-1) if __name__ == '__main__': main()