import sys
from collections import defaultdict
q,x=map(int,sys.stdin.readline().split())
import heapq
vis=defaultdict(int)
arr=[[0,i] for i in range(x)]
heapq.heapify(arr)
for _ in range(q):
    y=int(sys.stdin.readline())
    c=y%x
    vis[c]+=1
    heapq.heappush(arr,[vis[c],c])
    #print(vis)
    #print(arr,'arr')
    while arr[0][0]!=vis[arr[0][1]]:
        heapq.heappop(arr)
    a,b=arr[0]
    #print(a,b,'ab')
    print(a*(x)+b)
#print(vis)
