import sys
input=sys.stdin.buffer.readline #FOR READING PURE INTEGER INPUTS (space separation ok)

q,x=[int(x) for x in input().split()]
nIsCovered=[False for _ in range(4*(10**5)+1)]
multipleNotCovered=[0 for _ in range(x)] #multiplenotcovered[m]=z is the smallest z where nIsCovered[m+x*z]==False
currMEX=0
for _ in range(q):
    n=int(input())
    
    m=n%x
    z=multipleNotCovered[m]
    if m+x*z<len(nIsCovered):
        nIsCovered[m+x*z]=True
    multipleNotCovered[m]+=1
    
    while nIsCovered[currMEX]==True:
        currMEX+=1
    print(currMEX)