from sys import stdin, stdout

if __name__ == '__main__':
    qx = list(map(int, stdin.readline().split()))
    q = qx[0]
    x = qx[1]

    dic = {}
    s = set()
    mex = 0
    for i in range(q):

        y = int(stdin.readline())
        m = y % x

        if m not in dic:
            dic[m] = m
            s.add(m)
        else:
            dic[m] += x
            s.add(dic[m])

        while mex in s:
            mex += 1

        stdout.write(str(mex) + '\n')