T, X = map(int, input().split())
A = set()
MIN = 0
for I in range(T):
    Z = int(input())
    N = Z % X
    while N in A:
        N += X
    F = 0
    A.add(N)
    for K in range(MIN,N):
        if K not in A:
            F = 1
            MIN = K
            print(K)
            break
    if F == 0:
        print(max(A)+1)