#include <bits/stdc++.h>
const int BUFFER_SIZE = 1 << 25 | 1;
struct InputOutputStream {
  char ibuf[BUFFER_SIZE], obuf[BUFFER_SIZE], *s, *oh;
  InputOutputStream() : s(ibuf), oh(obuf) {
    ibuf[fread(ibuf, 1, BUFFER_SIZE, stdin)] = '\0';
  }
  ~InputOutputStream() { fwrite(obuf, 1, oh - obuf, stdout); }
  template <typename T>
  inline InputOutputStream &operator>>(T &x) {
    while (!isdigit(*s)) ++s;
    for (x = 0; isdigit(*s); ++s) x = x * 10 + (*s ^ '0');
    return *this;
  }
  template <typename T>
  inline InputOutputStream &operator<<(T x) {
    static char buf[23];
    register char *top = buf;
    if (x) {
      for (T t; x;) t = x / 10, *top++ = x - t * 10 + 48, x = t;
      while (top != buf) *oh++ = *--top;
    } else
      *oh++ = '0';
    *oh++ = ' ';
    return *this;
  }
} IO;
template <typename lhs, typename rhs>
inline lhs min(const lhs &x, const rhs &y) {
  return x < y ? x : y;
}
template <typename lhs, typename rhs>
inline lhs max(const lhs &x, const rhs &y) {
  return x > y ? x : y;
}
const int maxN = 400003;
int tub[maxN];
int main() {
  int Q, x;
  IO >> Q >> x;
  int ans = 0, times = 0;
  for (int i = 1; i <= Q; ++i) {
    int y;
    IO >> y;
    ++tub[y % x];
    while (tub[ans]) {
      --tub[ans];
      if (++ans == x) ans = 0, ++times;
    }
    printf("%d\n", times * x + ans);
  }
  return 0;
}
