import sys
input = sys.stdin.readline

q,x=map(int,input().split())
a=[0]*x
maxx=0
for _ in range(q):
    n=int(input())
    a[n%x]+=1
    while(a[maxx%x]!=0):
        a[maxx%x]-=1
        maxx+=1
    print(maxx)
        