from math import *
q,x=map(int,input().split())
m = [0] * (x)
ar = [0] * (10**7)
for o in range(q):
    n=int(input())
    mod=n%x
    c=m[mod]*x+mod
    m[mod]+=1
    ar[c]+=1
    for i in range(q):
        if ar[i]==0:
            print(i)
            break
