import sys
input = sys.stdin.readline
import collections


def main():
    q, X = [int(x) for x in input().split()]
    C = collections.Counter()
    next = 0
    total = 0
    for _ in range(q):
        y = int(input())
        if y % X == next:
            next += 1
            next %= X
            total += 1
            for i in range(next, next + X + 1):
                if C[i % X] >= 1:
                    next += 1
                    next %= X
                    total += 1
                    C[i % X] -= 1
                else:
                    break
            print(total)
        else:
            C[y % X] += 1
            print(total)


    
    
    

if __name__ == '__main__':
    main()


