q,x = map(int,input().split())
s,mex=set(),0
for i in range(q):
    val = int(input())
    if (val-x)>0 and val not in s and val-x>=mex:
        s.add(val-x)
    elif val not in s and val>=mex:
        s.add(val)
    elif val+x not in s and val+x>=mex:
        s.add(val+x)
    while mex in s:
        mex+=1
    print(mex)