n, m = (int(i) for i in input().split()) if m < n: if n % 2 == 1 and m % 2 == 0: print("-1") else: print(int(m / n))