#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];
int qt[N];
signed main() {
  ios::sync_with_stdio(false);
  int q, x, y;
  cin >> q >> x;
  set<pair<int, int>> vals;
  for (int i = 0; i < x; i++) vals.insert({qt[i], i});
  while (q--) {
    int y;
    cin >> y;
    y %= x;
    vals.erase({qt[y], y});
    vals.insert({++qt[y], y});
    auto k = *vals.begin();
    int nVal = k.first * x + k.second;
    cout << nVal << endl;
  }
  return 0;
}
