import sys
input = sys.stdin.readline

q,x = list(map(int,input().split()))
arr = [0 for i in range(x)]
cur = 0
for i in range(q):
    n = int(input())
    temp = n%x
    arr[temp]+=1
    while arr[cur%x]>0:
        arr[cur%x]-=1
        cur+=1
    sys.stdout.write(str(cur)+'\n')