#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Mon Aug  3 18:30:18 2020

@author: divyarth
"""

import sys
import heapq
import math

#sys.setrecursionlimit(100000)
input=sys.stdin.readline
print=sys.stdout.write

from collections import deque
from collections import defaultdict
from collections import Counter

modH=int(10**9)+7
I=lambda : list(map(int,input().split(' ')))
def PRINT(lst,sep=' '): print(sep.join(map(str,lst)))
'''
for _ in range(int(input())):
    a,b,c,n=I()
    ll=(a+b+c+n)/3
    if (a+b+c+n)%3==0 and ll-a>=0 and ll-b>=0 and ll-c>=0:
        print('YES')
    else:
        print('NO')
'''
'''
for _ in range(int(input())):
    n=int(input())
    ll=[I() for i in range(n)]
    ll.sort()
    flag=1
    for i in range(len(ll)):
        for j in range(i+1,len(ll)):
            if ll[j][0]<ll[i][0] or ll[j][1]<ll[i][1]:
                flag=0
                break
    if not flag:
        print('NO')
    else:
        print('YES')
        cur=(0,0)
        ans=[]
        for xx,yy in ll:
            ans.append((-cur[0]+xx)*'R'+(-cur[1]+yy)*'U')
            cur=xx,yy
        PRINT(ans,sep='')
                
        
'''

        
q,x=I()

mm=(q+1)
mex=[0]*(mm+1)
mex[0]=0

def findMex(j):
    for i in range(j,len(mex)):
        if mex[i]==0:
            return (i)


def findNext(a,mex,x):
    left=0
    right=10**9
    best=None
    while left<=right:
        mid=(left+right)//2
        if a+x*mid>mm or mex[a+x*mid]==0:
            best=a+x*mid
            right=mid-1
        else:
            left=mid+1
    if best<=mm:        
        mex[best]=1
    return best
        
m=0

ans=[]
for _ in range(q):
    a=int(input())
    bb=findNext(a%x,mex,x)
    m=findMex(m)
    ans.append(m)
PRINT(ans,sep='\n')

