from sys import stdin, stdout
from collections import defaultdict
n,x = map(int,input().split())
d = defaultdict(int)
if x==1:
    for i in range(1,n+1):
        a = int(stdin.readline())
        stdout.write(str(i)+'\n')
else:        
    m =0
    for i in range(n):
        a = int(stdin.readline())
        d[a%x]+=1
        while(d[m%x]>0):
            d[m%x]-=1
            m+=1
        stdout.write(str(m)+'\n')
    
    
    