from collections import deque
import sys

def inp():
    return sys.stdin.readline().strip()
for _ in range(1):
    q,x=map(int,inp().split())
    queries=[]
    for i in range(q):
        y=int(inp())
        queries.append(y)
    s=set()
    ans=[]
    mex=0
    mod={}
    for i in range(q):
        e=queries[i]
        if e%x not in mod:
            mod[e%x]=0
        mod[e%x]+=1
        s.add(e%x)
        while mex%x in s:
            if (mex//x)+1<=mod[mex%x]:
                mex+=1
            else:
                break
        print(mex)
            
        
        
    
    
    
    