n,m=map(int,input().split()) print(1) if m>=n else print(2 if m>=n//2 and n%2==0 else -1)