from sys import stdin, stdout 
import os.path
if os.path.isfile('inp.txt'):
    stdin = open("inp.txt", "r")
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)