import bisect
import sys
reader = (s.rstrip() for s in sys.stdin)
input = reader.__next__
def next_ans(ans,dp):
    # print(len(dp))
    for i in range(ans,len(dp)):
        if dp[i]==1:
            continue
        else:
            # print("ret",i)
            return i
n,x = [int(y) for y in input().split() ]

dp = [0]*400000
ans = 0
for i in range(n):
    # print(dp,ans)
    delta = int(input())
    if delta<ans:
        temp = ans-delta
        div = temp//x
        if temp%x==0:
            dp[ans]=1
            ans = next_ans(ans,dp)
        else:
            delta+=(div+1)*x
            dp[delta]=1
    elif delta ==ans:
        dp[ans]=1
        ans = next_ans(ans,dp)
    else:
        temp2 = delta-ans
        div2 = temp2//x
        # print(temp2,div2)
        if temp2%x==0:
            # print(55)
            dp[ans]=1
            # print(dp)
            ans = next_ans(ans,dp)
        else:
            delta-=div2*x
            dp[delta]=1
    print(ans)
