n, m = map(int, input().split()) k = (n + m - 1) // m if 2 * k > n: print(-1) else: print(k)