import java.util.*; import java.lang.*; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n= Integer.parseInt(sc.next()); int m = Integer.parseInt(sc.next()); if((m+n)%2==0)System.out.print(m/n); else System.out.print("-1"); System.out.println(); } }