from collections import deque n, k = map(int, input().split()) wins = deque() win_others = [[] for _ in range(n)] for i in range(n - 1, 0, -1): cnt = len(wins) + len(win_others[i]) if cnt == 0: wins.appendleft(i) elif cnt == 1: j = wins[0] if wins else win_others[i][0] p = i - (j - i) if p >= 0: win_others[p].append(i) if wins and wins[-1] == i + k: wins.pop() ans = sorted(win_others[0] + list(wins)) if ans: print(*ans, sep='\n') else: print(0)