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