import java.io.*; import java.util.*; public class Main_yukicoder531 { private static Scanner sc; private static Printer pr; private static void solve() { int n = sc.nextInt(); int m = sc.nextInt(); if (n % 2 == 0) { if (m < n / 2) { pr.println(-1); } else if (m >= n) { pr.println(1); } else { pr.println(2); } } else { if (m >= n) { pr.println(1); } else { pr.println(-1); } } } // --------------------------------------------------- public static void main(String[] args) { sc = new Scanner(System.in); pr = new Printer(System.out); solve(); pr.close(); sc.close(); } private static class Printer extends PrintWriter { Printer(PrintStream out) { super(out); } } }