import sys N, K = map(int, input().split()) if K >= N - 1: print(N - 1) sys.stdout.flush() exit() now = (N - 1) % (K + 1) print(now) sys.stdout.flush() while True: v = int(input()) if v >= N: exit() nex = K + 1 - (v - now) % (K + 1) now = v + nex print(now) sys.stdout.flush()