N, K = map(int, input().split()) A = (N + K) % (K + 1) print(A, flush=True) B = int(input()) while B < N: A += K + 1 print(A, flush=True) B = int(input())