n,m = [int(i) for i in input().split()] if m>=n: print(1) elif m>=n/2 and n%2==0: print(2) else: print(-1)