#include <bits/stdc++.h>
using namespace std;
void solve() {
  int q, x;
  cin >> q >> x;
  set<int> s;
  set<int>::iterator it;
  map<int, int> m;
  int mex = 0;
  int fl = 0;
  while (q--) {
    int a;
    cin >> a;
    if ((a % x) < mex) {
      s.insert(m[a % x] + x);
      m[a % x] += x;
      if (s.find(m[a % x]) != s.end()) it = s.find(m[a % x]);
    } else {
      s.insert(a % x);
      m[a % x] = a % x;
      if (s.find(a % x) != s.end()) it = s.find(a % x);
    }
    if (fl == 0) {
      it = s.begin();
      fl = 1;
    }
    while (it != s.end() && *it == mex) {
      it++;
      mex++;
    }
    if (it == s.end()) it--;
    cout << mex << '\n';
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int TESTS = 1;
  while (TESTS--) {
    solve();
  }
  return 0;
}
