#include <bits/stdc++.h>
using namespace std;
int main() {
  int q, x, i, j, nbrOfRuns, nbrDecrease;
  bool ok;
  cin >> q;
  cin >> x;
  long long* tab = new long long[q];
  int* tabNbr = new int[x];
  for (i = 0; i < x; i++) {
    tabNbr[i] = 0;
  }
  for (i = 0; i < q; i++) {
    cin >> tab[i];
    if (x != 1) {
      tabNbr[tab[i] % x]++;
      ok = true;
      nbrDecrease = 1;
      nbrOfRuns = 0;
      while (ok) {
        for (j = 0; j < x; j++) {
          if ((tabNbr[j] - nbrDecrease) < 0) {
            ok = false;
            break;
          }
        }
        nbrDecrease++;
        if (ok) {
          nbrOfRuns += x;
        }
      }
      cout << nbrOfRuns + j << endl;
    } else {
      cout << i << endl;
    }
  }
}
