from collections import Counter
from collections import defaultdict
import math
import random
import heapq as hq
from math import sqrt
import sys
from functools import reduce


def input():
    return sys.stdin.readline().strip()


def iinput():
    return int(input())


def tinput():
    return input().split()


def rinput():
    return map(int, tinput())


def rlinput():
    return list(rinput())


mod = int(1e9)+7


def solve(adj, colors, n):
    pass


def root(parent, a):
    while parent[a] != a:
        parent[a] = parent[parent[a]]
        a = parent[a]
    return a


def union(parent, size, a, b):
    roota, rootb = root(parent, a), root(parent, b)
    if roota == rootb:
        return
    parent[rootb] = roota
    size[roota] += size[rootb]
    size[rootb] = 0


def factors(n):
    return set(reduce(list.__add__,
                      ([i, n//i] for i in range(1, int(n**0.5) + 1) if n % i == 0)))


if __name__ == "__main__":
    n, x = rinput()
    d = [0]*x
    mn = -1
    ans=0
    for _ in range(n):
        q = iinput()
        d[q % x] += 1
        while d[ans%x] > 0:
            d[ans%x]-=1
            ans+=1
        print(ans)
