from sys import stdin
from collections import defaultdict
input=stdin.readline
q,x=map(int,input().split())
mex=0
box=defaultdict(int)
for i in range(q):
  y=int(input())
  box[y%x]+=1
  while box[mex%x]>0:
    box[mex%x]-=1
    mex+=1
  print(mex)