from sys import stdin, stdout 
res = 0
d = [0 for i in range(400005)]
q, x = map(int, stdin.readline().split())
for _ in range(q):
    n = int(stdin.readline())
    d[n % x] += 1
    while d[res % x] > res / x:
        res += 1
    print(res)