from collections import defaultdict
q,x = map(int, raw_input().strip().split())
maxn = 4*10**5
nums = set()
cur_min = 0
num_dict = defaultdict(int)
for i in range(x + 1):
    num_dict[i] = i
for _ in range(q):
    num = int(raw_input().strip())
    nums.add(num_dict[num%x])
    num_dict[num%x] += x
    while cur_min <= maxn:
        if cur_min not in nums:
            break
        cur_min += 1
    print cur_min 
    

