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