import heapq
import io, os
input = io.BytesIO(os.read(0,os.fstat(0).st_size)).readline
q,x=list(map(int,input().split()))
lis=[0]*x
p=0
for j in range(q):
    n=int(input())
    r=n%x
    lis[r]+=1
    while lis[p%x]>0:
        lis[p%x]-=1
        p+=1
    print(p)