import sys
input = sys.stdin.readline
a,x=map(int,input().split())
dp=[0]*(x)
p=0
m=0
for _ in range(a):
    y=int(input())
    dp[y%x]+=1
    while dp[m%x]>0:
        dp[m%x]-=1
        m+=1
    print(m)
    		 		 	       				  		 	  	