from sys import stdin,stdout
def main():    
    q,x = map(int,stdin.readline().split())
    cnt = [0]*400010
    menor = 0
    for c in range(q):
        a = int(stdin.readline()) % x
        cnt[a] += 1
        while cnt[menor%x] > menor//x:
            menor += 1

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

if __name__ == "__main__":
    main()
