import sys
import math
input=sys.stdin.readline

 
  
q,x=map(int,input().split())
a=list()
for i in range(x):
    a.append(i)
dc=dict()
res=0
mex=0
for _ in range(q):
    y=int(input())
    y=y%x
    dc[a[y]]=1
    while(True):
        if(res not in dc.keys()):
            print(res)
            break
        res+=1
    a[y]+=x
    
    
        
                        
    
                        
                    
        
            
    


    


    
            
    
    
            

    
    
        
    
    
