n=0 a,b=map(int,input().split()) x=-1 if b==0: x=1 elif a==-1: x=2 print(x)