import sys
 
# inf = open('input.txt', 'r')
# reader = (line.rstrip() for line in inf)
reader = (line.rstrip() for line in sys.stdin)
input = reader.__next__
 
class SegmTree():
    '''
    - modify single element
    - get first min on interval
    '''
    def __init__(self, size):
        N = 1
        while N < size:
            N <<= 1
        self.N = N
        self.tree = [(float('inf'), -1) for _ in range(2 * N)]
        for i in range(size):
            self.tree[i + N] = (0, i)
        self.build()
    
    def build(self):
        for i in range(self.N - 1, 0, -1):
            self.tree[i] = min(self.tree[i<<1], self.tree[i<<1|1])
 
    def inc(self, i):
        tree = self.tree
        i += self.N
        occ, rem = tree[i]
        tree[i] = (occ + 1, rem)
        while i > 1:
            tree[i>>1] = min(tree[i], tree[i^1])
            i >>= 1
 
    def query_range(self, l, r):
        tree = self.tree
        l += self.N
        r += self.N
        result = (float('inf'), -1)
        while l < r:
            if l & 1:
                result = min(result, tree[l])
                l += 1
            if r & 1:
                r -= 1
                result = min(result, tree[r])
            l >>= 1
            r >>= 1
        return result
 
q, x = map(int, input().split())
st = SegmTree(x)
for _ in range(q):
    val = int(input())
    st.inc(val % x)
    minOcc, rem = st.tree[1]
    mex = minOcc * x + rem
    print(mex)
 
# inf.close()