# -*- coding:utf-8 -*- if __name__ == "__main__": n,k = map(int,raw_input().split()) rest = n % (k+1) if rest == 1: now = 0 else: now = rest - 1 print now while True: opponent = input() if opponent >= n: break now += (k+1) print now