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