#include <bits/stdc++.h>
using namespace std;
const int INF = 0x3f3f3f3f;
const double eps = 1e-10;
const int maxn = 4e5 + 7;
const int maxm = (1 << 10) + 7;
int vis[maxn];
set<int> s[maxn];
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int q, x;
  cin >> q >> x;
  int ans = 0;
  for (int i = 0; i < x; ++i) s[0].insert(i);
  while (q--) {
    int p;
    cin >> p;
    p %= x;
    s[vis[p]].erase(p);
    vis[p]++;
    s[vis[p]].insert(p);
    while (s[ans].empty()) ans++;
    cout << ans * x + (*s[ans].begin()) << endl;
  }
  return 0;
}
