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