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())
a=[0]*x
maxx=0
for _ in range(q):
    n=int(input())
    a[n%x]+=1
    while a[maxx%x]!=0:
        a[maxx%x]-=1
        maxx+=1
    print(maxx)
        