import sys
import heapq
q, x = map(int, sys.stdin.readline().rstrip().split())
target = 0
h = dict()
for _ in range(q):
    n = int(sys.stdin.readline().rstrip())
    if target % x == n % x:
        target += 1
        while True:
            if len(h) == 0:
                break
            try:
                if h[target%x] >= 1:
                    h[target%x] -= 1
                    target += 1
                else:
                    break
            except:
                break
        print(target)
    else:
        try:
            h[n % x] += 1
        except:
            h[n % x] = 1
        while True:
            if len(h) == 0:
                break
            try:
                if h[target%x] >= 1:
                    target += 1
                    h[target%x] -= 1
                else:
                    break
            except:
                break
        print(target)