from sys import stdin, stdout

def main():
    arr = list(map(int, stdin.readline().split()))
    N = arr[0]
    X = arr[1]
    counter = dict()
    for i in range(X):
        counter[i] = 0
    maxer = 0
    for i in range(N):
        new_num = int(stdin.readline())
        counter[new_num % X] += 1
        while (counter[maxer % X] > 0):
            counter[maxer % X] -= 1
            maxer += 1
        stdout.write(str(maxer)+"\n")

main()