from bisect import bisect_left as bl
from bisect import bisect_right as br
import heapq
import math
from collections import *
from functools import reduce,cmp_to_key
import sys
input = sys.stdin.readline
 
# M = mod = 998244353
def factors(n):return sorted(set(reduce(list.__add__, ([i, n//i] for i in range(1, int(n**0.5) + 1) if n % i == 0))))
# def inv_mod(n):return pow(n, mod - 2, mod)
 
def li():return [int(i) for i in input().rstrip('\n').split()]
def st():return input().rstrip('\n')
def val():return int(input().rstrip('\n'))
def li2():return [i for i in input().rstrip('\n').split(' ')]
def li3():return [int(i) for i in input().rstrip('\n')]


currcount = 0
q, x = li()
d = defaultdict(int)
lastmin = defaultdict(int)

for i in range(q):
    ele = val()
    if not lastmin[ele%x]:
        lastmin[ele%x] = 1
    else:
        lastmin[ele%x] += 1
    d[x*(lastmin[ele%x] - 1) + ele%x] = 1




    while d[currcount]:currcount += 1
    print(currcount)