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