import sys
input = sys.stdin.readline

q, x = map(int, input().split())

arr = [0]*x

MEX=0
for _ in range(q):
    y = int(input())
    arr[y%x]+=1
    while (arr[MEX%x]):
        arr[MEX%x]-=1
        MEX+=1
    print (MEX)
