q,x = map( int, input().split() )
e = set({})
MEX = 0
if x == 1:
    for i in range(q):
        print(i)
else:
    for i in range(q):
        m = int(input())
        if m in e:
            while m in e:
                m +=x
        else:
            while not(m in e) and m>-1:
                m-=x
            m+=x
        e.add(m)
        while MEX in e:
            MEX+=1
        print(MEX)