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

