from sys import stdin,stdout
for _ in range(1):#int(stdin.readline())):
    # n=int(stdin.readline())
    n,x=list(map(int,stdin.readline().split()))
    cnt=[0]*n;mx=0
    for i in range(n):
        v=int(stdin.readline())
        cnt[v%x]+=1
        while cnt[mx%x]>0:
            cnt[mx%x]-=1
            mx+=1
        print(mx)