#include <bits/stdc++.h>
using namespace std;
const int maxn = 5e5 + 10;
int vis[maxn * 2];
int num[maxn * 2];
int main() {
  int n, x, v;
  scanf("%d%d", &n, &x);
  int t = 0, now = 0;
  for (int i = 1; i <= n; ++i) {
    scanf("%d", &v);
    v = v % x;
    if (v >= maxn) continue;
    int t = num[v];
    if (t * x + v < maxn) {
      vis[x * t + v] = 1;
      num[v]++;
    }
    while (now < maxn && vis[now] == 1) {
      now++;
    }
    cout << now << "\n";
  }
  return 0;
}
