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