n, m = list(map(int,input().split())) if n <= m: print(1) elif n % 2 == 1 or m == 1: print(-1) else: print(n/m + 1)