import sys
input = sys.stdin.readline
Q,x=map(int,input().split())
ans=0
rem=[0]*x
L=[]
for i in range(Q):
    N=int(input())
    rem[N%x]+=1
    while rem[ans%x]>0:
        rem[ans%x]-=1
        ans+=1
    print(ans)
    