(q, x) = map(int, input().split())
y = [0]*x
ans = list()
zero_ind = set()
zero = [1]*x
d = 1
for kek in range(q):
    a = int(input())
    a %= x
    y[a] += 1
    if len(zero) >= x-a:
        zero[x-a-1] = 0
    while len(zero) > 0 and zero[-1] == 0:
        zero.pop()
    if len(zero) == 0:
        d += 1
        zero = [1] * x
        for i in range(x):
            y[i] -= 1
            if y[i] != 0:
                zero[x-i-1] = 0
    while len(zero) > 0 and zero[-1] == 0:
        zero.pop()
    ans.append((d*x - len(zero)))
print(*ans, sep='\n')