#include <bits/stdc++.h>
using namespace std;
set<pair<int, int> > m;
int main() {
  int T, x, temp;
  cin >> T >> x;
  vector<int> cnt(x);
  for (int i = 0; i < x; i++) m.insert(make_pair(0, i));
  for (int t = 1; t <= T; t++) {
    cin >> temp;
    temp %= x;
    m.erase(make_pair(cnt[temp], temp));
    cnt[temp]++;
    m.insert(make_pair(cnt[temp], temp));
    cout << m.begin()->first * x + m.begin()->second << endl;
  }
}
