q, x = map(int, input().split())
s = dict()
z = [0 for i in range(x)]
mex = 0
for i in range(q):
    y = int(input())
    if y % x in z:
        z[y % x] += 1
    else:
        z[y % x] = 1
    if y in s:
        s[y] += 1
    else:
        s[y] = 1
    a = y
    while a == mex and a in s:
        mex += 1
        a += 1
    newmex = mex
    while 1:
        if z[newmex % x] > newmex // x:
            newmex += 1
        else:
            break
    print(newmex)
