N,M=map(int,input().split()) if M>=N: print(1) elif N%2==0 and M>=N/2: print(2) else: print(-1)