N, K = map(int, input().split()) # ... 2 1 0 K ... 3 2 1 gr = (N - 1) % (K + 1) x = gr while x < N: print(x, flush = True) h = int(input()) x += K + 1