q, x = map(int, input().split())
mark = [0]*(4*(10**5)+1)
ans = 0
for i in range(q):
    n = int(input())
    mark[n%x] += 1
    while ans < 10**9:
        if mark[ans%x] > 1:
            mark[ans%x]-= 1
            ans += 1
        else:
            break
    print(ans)