from sys import stdin, stdout

class Solve:
  q = x = ans = n = 0
  d = {}
  ANS = []
  
  def bsearch(self, l, r, rem, ret):
    if l > r:
      return ret
    mid = (l+r) // 2
    number = rem + self.x * mid
    if number not in self.d:
      ret = number
      return self.bsearch(l, mid-1, rem, ret)
    else:
      return self.bsearch(mid+1, r, rem, ret)
      
  
  def solve(self):
    self.q,self.x = map(int, stdin.readline().split())
    l,r = 0,1000000000//self.x
    for _ in range(self.q):
      self.n = int(stdin.readline())
      ret = self.bsearch(l, r, self.n%self.x, self.n)
      self.d[ret] = 1
      while self.ans in self.d:
        self.ans += 1
      self.ANS.append(str(self.ans))
    stdout.write('\n'.join(self.ANS))
    return 0

def main():
  s = Solve()
  s.solve()
        
main()