# -*- coding: utf-8 -*-

# Baqir Khan
# Software Engineer (Backend)
from collections import defaultdict
from sys import stdin

inp = stdin.readline

q, x = map(int, inp().split())
freq = defaultdict(int)
ans = 0

while q:
    q -= 1

    a = int(inp())
    freq[a % x] += 1

    while freq[ans % x] > 0:
        freq[ans % x] -= 1
        ans += 1

    print(ans)
