#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long int q, x, p = 0, mex = 0;
  cin >> q >> x;
  vector<long long int> a(q), b(q);
  vector<vector<long long int>> occ(pow(10, 5) * 5);
  vector<bool> vis(q, 0);
  map<long long int, long long int> M;
  while (q--) {
    long long int y;
    cin >> y;
    a[p] = (y % x);
    occ[y % x].push_back(p);
    p++;
  }
  for (long long int i = 0; i < a.size(); i++) {
    if (vis[i] == 0) {
      long long int k = 0;
      for (long long int j = 0; j < occ[a[i]].size(); j++) {
        b[occ[a[i]][j]] = a[occ[a[i]][j]] + (k++) * x;
        vis[occ[a[i]][j]] = 1;
      }
    }
    M[b[i]]++;
    while (M[mex]) {
      mex++;
    }
    cout << mex << endl;
  }
}
