#include <bits/stdc++.h>
using namespace std;
int num[400010];
bool vis[400010];
int main() {
  int q, x, y, ans = 0;
  cin >> q >> x;
  for (int i = 1; i <= q; i++) {
    cin >> y;
    y %= x;
    unsigned long long tmp = (unsigned long long)num[y] * x + y;
    if (tmp <= q) vis[tmp] = 1;
    num[y]++;
    while (vis[ans]) ans++;
    cout << ans << endl;
  }
  return 0;
}
