n, m = io.read("*n", "*n") if(n <= m) then print(1) else if(n <= m * 2 and n % 2 == 0) then print(2) else print(-1) end end