import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner scan = new Scanner(System.in); int n = scan.nextInt(); int m = scan.nextInt(); scan.close(); if(m >= n) { System.out.println(1); }else { if(n % 2 == 0 && 2 * m >= n) { System.out.println(2); }else { System.out.println(-1); } } } }