import sys
input = sys.stdin.readline


q, x = map(int, input().split())
a = [0] * x
ans = 0
for i in range(q):
    n = int(input())
    a[n % x] += 1
    while a[ans % x]:
        a[ans % x] -= 1
        ans += 1
    print(ans)
