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