from collections import defaultdict as dd
from sys import stdin,stdout
input=stdin.readline
q,x=map(int,input().split())
a=[]
b=[0]*x
p=0
m=0
for _ in range(q):
    i=int(input())
    z=i%x
    b[z]+=1
    while b[p]>m:
        p+=1
        if p==x:
            m+=1
            p=0
    stdout.write(str(m*x+p)+'\n')