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

rem=[0 for _ in range(x)]
mmInd=0
prev=0
 
inp=[]
for i in range(q):
    inp.append(int(input())%x)

for x in inp:
    
    rem[x]+=1
    mm=min(rem)
    l= rem.index(mm) + x*(mm)
    
    print(l)

