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