import sys
n,k=map(int,input().split())
a=[0]*(k)
c=0
s=[]
for j in range(n):
    a[int(sys.stdin.readline())%k]+=1
    while a[c%k]>0:
        a[c%k]-=1
        c+=1
    s.append(c)
print('\n'.join(map(str,s)))