#include <bits/stdc++.h>
using namespace std;
long long int xs[400005];
int main() {
  long long int q;
  long long int xn;
  cin >> q >> xn;
  long long int xind = 0;
  for (int i = 0; i < q; i++) {
    long long int temp;
    cin >> temp;
    if (xs[temp % xn] && xs[temp % xn] * xn + temp % xn <= q)
      xs[xs[temp % xn] * xn + temp % xn]++;
    xs[temp % xn]++;
    while (xs[xind]) {
      xind++;
    }
    cout << xind << endl;
  }
}
