let () = let n, m = Scanf.scanf "%d %d " (fun n m -> n, m) in Printf.printf "%d\n" (if n <= m then 1 else if n mod 2 = 1 then (-1) else if n / 2 <= m then 2 else (-1))