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