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 % m != 0 || n / m > m && n % m == 0) { minDate = -1; } else if (n / m <= m && n % m == 0) { minDate = n / m; } System.out.println(minDate); } }