#include <bits/stdc++.h>
using namespace std;
int ost[400200];
int main() {
  int q, x;
  cin >> q >> x;
  for (int i = 1; i <= q; i++) {
    int a, m = 1e9, prm, j = -1;
    cin >> a;
    ost[a % x]++;
    for (int i = 0; i < x; i++) {
      if (m >= ost[i]) {
        if (m != ost[i]) prm = j;
        m = ost[i];
        j = i;
      }
    }
    cout << m * x + prm + 1 << "\n";
  }
  return 0;
}
