#include <bits/stdc++.h>
using namespace std;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
template <typename T>
void DEBUG(string label, T value) {
  cerr << "[" << label << " = " << value << "]\n";
}
int main(int argv, char **argc) {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int n, x;
  cin >> n >> x;
  map<int, int> cnt;
  queue<int> q;
  for (int i = 0; i < n; ++i) {
    int a;
    cin >> a;
    a %= x;
    cnt[a]++;
    while (!q.empty()) {
      int t = q.front() % x;
      if (cnt.count(t)) {
        cnt[t]--;
        if (cnt[t] == 0) {
          cnt.erase(t);
        }
        q.pop();
      } else {
        break;
      }
    }
    if (cnt.count(i % x) == 0) {
      q.push(i);
    } else {
      cnt[i % x]--;
      if (cnt[i % x] == 0) {
        cnt.erase(i % x);
      }
    }
    if (q.empty()) {
      cout << i + 1 << endl;
    } else {
      cout << q.front() << endl;
    }
  }
}
