from sys import stdin, stdout  
import collections
import heapq
import itertools
import functools

def read_line():
    return stdin.readline().strip()
def read_int():
    return int(read_line())
def read_arr():
    return read_line().split(' ')
def read_int_arr():
    return [int(x) for x in read_arr()]
def query_interactive(s):
    print(s)
    stdout.flush()
    
def main():
    q, x = read_int_arr()
    mods = collections.defaultdict(int)
    cur = 0
    for i in range(0, x):
        mods[i] = 0
    for _ in range(q):
        qu = read_int()
        mod = qu % x
        mods[mod] += 1
        while mods[cur % x] > 0:
            mods[cur % x] -= 1
            cur += 1
        print(cur)

if __name__ == "__main__":
    main()