from sys import *
arr = [int(x) for x in stdin.readline().split()] 
x,y = arr[0],arr[1]
lst = [0]*x
ans=0
for _ in range(x):
    a=int(stdin.readline())
    index=a%y
    lst[index]+=1
    while lst[ans%y]>0 :
        lst[ans%y]-=1
        ans+=1
    stdout.write(str(ans)+'\n')
    