n,k = map(int,input().split()) if (n-1)%(k+1) == 0: print(0,flush=True) now=int(input()) if now >= n: exit() else: now = 0 while True: a=((n-1)-now)%(k+1) print(a+now,flush=True) now = int(input()) if now >= n: break