#include <bits/stdc++.h>
#pragma GCC optimize(2)
using namespace std;
const int INF = 1e9 + 7;
const int N = 4e5 + 7;
const int M = 5e6 + 7;
int vis[M];
int p[N];
signed main() {
  int q, x, y;
  scanf("%d", &q);
  scanf("%d", &x);
  int head = 0;
  for (int i = 0; i < N; i++) p[i] = i;
  while (q--) {
    scanf("%d", &y);
    if (y > head) {
      int k = (y - head) / x;
      y -= k * x;
      if (y == head)
        vis[head] = 1, p[y] += x;
      else {
        if (p[y] > M) continue;
        vis[p[y]] = 1;
        p[y] += x;
      }
    } else if (y == head)
      vis[head] = 1, p[y] += x;
    else {
      int k = (head - y) / x;
      y += k * x;
      if (y == head)
        vis[head] = 1, p[y] += x;
      else {
        if (p[y] > M) continue;
        vis[p[y]] = 1;
        p[y] += x;
      }
    }
    while (vis[head]) head++;
    printf("%d\n", head);
  }
  return 0;
}
