n, k = map(int, input().split()) r = (n - 1) % (k + 1) print(r) curr = r i = 1 while True: y = int(input()) if y >= n: break curr += y print(i * (k + 1) + r - curr)