import math,string,itertools,fractions,heapq,collections,re,array,bisect,copy

q, x = list(map(int, input().strip().split(" ")))
c = [0] * x
mex = 0
ans = []
for i in range(q):
  y = int(input().strip())
  c[y % x] += 1
  while c[mex % x] > (mex / x):
    mex += 1
  ans.append(mex)
print("\n".join(map(str, ans)))