from collections import Counter, defaultdict
from sys import stdin, stdout
raw_input = stdin.readline
d=Counter()
q,x=map(int,raw_input().split())
ans=0
c=x
var=0
for q in xrange(q):
    y=input()
    if not d[y%x]:
        c-=1
    d[y%x]+=1
    if c==0:
        for i in xrange(x):
            d[i]-=1
        c=x
        ans=0
        var+=1
    while d[ans]:
        ans+=1
    stdout.write(str((var*x)+ans)+'\n')
