def fastio():
	import sys
	from io import StringIO 
	from atexit import register
	global input
	sys.stdin = StringIO(sys.stdin.read())
	input = lambda : sys.stdin.readline().rstrip('\r\n')
	sys.stdout = StringIO()
	register(lambda : sys.__stdout__.write(sys.stdout.getvalue()))
fastio()

q,x=map(int,input().split())
l=set()
for i in range(4*10**5+1):
    l.add(i)
a=[0]*x
for _ in range(q):
    val=int(input())
    val=val%x
    z=a[val]*x+val
    if z in l:
        l.remove(z)
    a[val]+=1
    for i in l:
        print(i)
        break
        