from collections import Counter
from sys import stdin

def input():
    return(next(stdin))

def main():
    q,x = map(int, input().split())
    aa = []
    counts = Counter()
    mex = 0
    for _ in range(q):
        a = int(input())%x
        counts[a] += 1
        while counts[mex%x] > 0:
            counts[mex%x] -= 1
            mex += 1
        print(mex)




if __name__ == "__main__":
    main()