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