import sys
def minp():
    return sys.stdin.readline().strip()
def mint():
    return int(minp()) 
def mints():
    return map(int, minp().split())
q,x=map(int,input().split())
remain=[0]*x
mex=0
for _ in range(q):
    y=mint()
    remain[y%x]+=1
    while remain[mex%x]>0:
        remain[mex%x]-=1
        mex+=1
    print(mex)