#include <bits/stdc++.h>
using namespace std;
const int N = 4e5 + 5, mod = 1e9 + 7;
void solve() {
  int q, x;
  cin >> q >> x;
  int a[N];
  bool b[N];
  memset(a, 0, sizeof(a));
  memset(b, 0, sizeof(b));
  int id = 0;
  for (int i = 0; i < q; ++i) {
    int y;
    cin >> y;
    int r = y % x;
    b[r + (x * a[r])] = true;
    ++a[r];
    while (1) {
      if (b[id] == false) {
        cout << id << endl;
        break;
      }
      ++id;
    }
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int t = 1;
  while (t--) solve();
  return 0;
}
