q,x=map(int,input().split())
l=set()
for i in range(10**4+1):
    l.add(i)
a=[0]*x
for _ in range(q):
    val=int(input())
    val=val%x
    if a[val]*x+val in l:
        l.remove(a[val]*x+val)
    a[val]+=1
    for i in l:
        print(i)
        break
        