n,m = map(int,input().split(' ')) if m >= n or n % 2 == 0 and m >= n // 2: print((n - 1) // m + 1) else: print("-1")