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