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