q, x = map(int, input().split())
list1 = [0] * x
list2 = []
count = 0

for i in range(q):
    p = int(input())

    list1[p % x] += 1
    while list1[count % x] != 0:
        list1[count % x] -= 1
        count += 1
    list2.append(count)
print(*list2)    