q,x = map( int, input().split() )
e = {}
MEX = 0
n = 0
def cmod(n,x):
    if n == x:
        return 0
    else:
        return n
for i in range(q):
    m = int(input())%x
    if m in e:
        e[m] += 1
    else:
        e[m] = 1
    while  n in e:
            if e[n]>1:
                e[n] -= 1
                MEX += 1
                n = cmod(n + 1,x) 
            else:
                break
    print(MEX)