q, x = map(int, input().split())
ar = [0 for i in range(q + 1)]
ost = [0 for i in range(x)]
mex = 0

for i in range(q):
    a = int(input())
    a = a % x
    if (x * ar[a] + a < q):
        ar[a] = 1 
    ost[a]+=1 
    while (ar[mex] == 1):
        mex+=1
        
    print(mex)