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