import sys
input = sys.stdin.readline
m, maxn = {}, int(4e5)
t, x = list(map(int, input().split()))
Mex = 0
for _ in range(t):
    n = int(input())
    ans = (Mex - n) // x
    l, r = ans, (maxn - n) // x
    mid = l
    while l <= r:
        mid = (l + r) // 2
        if (n + mid * x) in m:
            l = mid + 1
        else:
            r = mid - 1
    m[n + l * x] = 'Lin'
    while Mex in m:
        Mex += 1
    print(Mex)
