from sys import stdin
from _collections import deque
mod = 10**9 + 7
import sys
sys.setrecursionlimit(10**5)
from queue import PriorityQueue
from bisect import bisect_right
from bisect import bisect_left
from _collections import defaultdict
from math import sqrt,factorial,gcd,log2,inf,ceil
import heapq
input = lambda : sys.stdin.readline().rstrip()
from sys import stdin, stdout
from heapq import heapify,heappush,heappop

# min = 0
# n,m = map(int,input().split())
# maxi = n
# z = m
# while z>0:
#
#     yo = (1+sqrt(1+8*z))//2
#     maxi-=yo
#     print(yo)
#     z-=((yo)*(yo+1))//2
#
#
# maxi = max(int(maxi),0)
#
#
#
# if m>=n-1:
#     min = 0
# else:
#     min = (n)-2*(m)
# #
# if m == 0:
#     print(n,n)
#     exit()
# if n == 1 and m == 1:
#     min = 1
# print(min,maxi)

q,x = map(int,input().split())

l = [0]*x

ans = 0
yo = []
for _ in range(q):

    z = int(input())
    l[z%x]+=1
    while l[ans%x]:

        l[ans%x]-=1
        ans+=1
    yo.append(ans)

print('\n'.join(map(str,yo)))


