import sys
input = sys.stdin.readline



q,x = map(int,input().split())
Table = [0] * x
# THis is our table      
# Value                     0     1    2    3     4     5  ..    x - 1  
# How many encountered      0     0    0    0     0     0  ..      0   


hunting = 0
for i in range(q):
    val = int(input()) % x
    Table[val] += 1
    # print(Table)
    # max search x times (cyclic)
    while(Table[hunting%x]>0):
        Table[hunting%x] -= 1 # Removing it because yes yes yes we reached the minimum
        # print(hunting)
        hunting += 1
    print(hunting)

