#include <bits/stdc++.h>
using namespace std;
inline int read() {
  int x = 0, f = 1;
  char c = getchar();
  while (c != '-' && (c < '0' || c > '9')) c = getchar();
  if (c == '-') f = -1, c = getchar();
  while (c >= '0' && c <= '9') x = x * 10 + c - '0', c = getchar();
  return f * x;
}
const int maxn = 5e5 + 7;
const int inf = 0x3f3f3f3f;
const int mod = 1e9 + 7;
long long vis[maxn], mx[maxn];
int main() {
  int q = read(), x = read();
  memset(mx, -1, sizeof(mx));
  int p = 0;
  for (int i = 1; i <= q; ++i) {
    int y = read() % x;
    if (mx[y] == -1)
      mx[y] = y;
    else
      mx[y] += x;
    if (mx[y] < maxn) vis[mx[y]] = 1;
    while (vis[p]) p++;
    printf("%d\n", p);
  }
}
