a,b=[int(Z) for Z in input().split(" ")]
s=[0]*b
A=b-1
m=0
for i in range (a):
    x=int(input())
    if m==s[x%b]:
        s[x%b]+=1
        m+=1
    else:
        s[x%b]+=1
    q=0
    for j in (s):
        if j>m:
            q+=1
        else:
            break
    print(m*b +q)