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 = K + 1 - x