"""
NTC here
"""
import sys
inp= sys.stdin.readline
input = lambda : inp().strip()
flush= sys.stdout.flush
# import threading
# sys.setrecursionlimit(10**6)
# threading.stack_size(2**25)

def iin(): return int(input())
def lin(): return list(map(int, input().split()))

# range = xrange
# input = raw_input

def main():
    q, x =lin()
    mx  = 4*(10**5)+1+x
    ch = 0
    fact = [[] for i in range(x)] 
    for _ in range(q):
        y = iin()
        fact[y%x].append(y)
        while ch<mx:
            if fact[ch%x]:
                fact[ch%x].pop()
                ch+=1
            else:
                break
        print(ch)
        



            



            
        

        
main()
# threading.Thread(target=main).start()
