# pizdec
import sys

input = sys.stdin.readline;

q, x = map(int, input().split())

nfr = [0 for i in range(x)]
ans = 0

for i in range(q):

    now = int(input())

    nfr[now % x] += 1

    while nfr[ans % x]:
        nfr[ans % x] -= 1;
        ans += 1;

    print(ans)
