#include <bits/stdc++.h>
using namespace std;
const double PI = acos(-1);
const long long mod = 1e9 + 7;
int vis[400050];
int main() {
  int q, x;
  cin >> q >> x;
  long long t = 0, n;
  for (int i = 0; i < q; i++) {
    cin >> n;
    if (x != 1) {
      n %= x;
      while (n < 400050 && vis[n]) n += x;
      if (n < 400050) vis[n] = 1;
      while (vis[t]) t++;
      cout << t << endl;
    } else
      cout << t++ << endl;
  }
  return 0;
}
