
from sys import stdin
input = stdin.buffer.readline
import math

q,x=map(int,input().split())

mex=0
s=set()
d={}

for i in range(q):
    y=int(input())
    n=y//x
    
    idd=y-n*x
    if (max(y,mex)-min(y,mex))%x==0:
        d[idd]=mex
        s.add(d[idd])
        p=mex
        while (p in s):
            p=p+1
        mex=p
    else:
        if idd in d:
            d[idd]=d[idd]+x
        else:
            d[idd]=math.ceil((mex-idd)/x)  
        s.add(d[idd])
    print(mex)