import sys
q, x = map(int, input().split())
arr = [0] * x
n = 0
for _ in range(q):
    num = int(sys.stdin.readline())
    arr[num % x] += 1
    while arr[n % x]:
        arr[n % x] -= 1
        n += 1
    print(n)