#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int q, x;
  cin >> q >> x;
  vector<int> rem(x);
  vector<bool> a(q);
  int mes = 0;
  for (int i = 0; i < q; i++) {
    int y;
    cin >> y;
    int r = y % x;
    rem[r]++;
    int ind = (rem[r] - 1) * x + r;
    if (ind < q) a[ind] = true;
    while (a[mes]) mes++;
    cout << mes << '\n';
  }
}
