animal,ship = map(int,input().split(" ")) if animal <= ship: print(1) elif animal%2 ==1 or animal/2 > ship: print(-1) else: print(2)