import sys
input = sys.stdin.readline
q,x = map(int,input().split())
d = {}
ans = 0
for _ in range(q):
    y = int(input())
    c = y%x
    if c in d:
        d[c] += 1

    else:
        d[c] = 1

    while True:
        v = ans % x
        if v in d:
            ans += 1
            d[v] -= 1
            if d[v] == 0:
                del d[v]

        else:
            break

    # ans += 1
    sys.stdout.write(str(ans)+"\n")