import sys
input = sys.stdin.readline
from collections import defaultdict
q,x = [int(i) for i in input().rstrip('\n').split()]
d,lastmin = [defaultdict(int)]*2
currcount = 0
for i in range(q):
    ele = int(input())
    lastmin[ele%x] += 1
    d[x*(lastmin[ele%x] - 1) + ele%x] = 1
    while d[currcount]:currcount += 1
    print(currcount)