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