import sys
input = sys.stdin.readline
q,x = list(map(int, input().split()))
array = [0]*x
ans = 0
for _ in range(q):
    n = int(input())
    array[n%x] += 1
    while array[ans%x]:
        array[ans%x] -= 1
        ans += 1
    print(ans)