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