#include <bits/stdc++.h>
using namespace std;
const int MOD = 1e9 + 7;
const int MAX = 2147483647;
const int MIN = -2147483648;
const vector<vector<int>> dirs = {{0, 1}, {1, 0}, {-1, 0}, {0, -1}};
set<pair<int, int>> num_occ;
map<int, int> freq;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  int q, x;
  cin >> q >> x;
  for (int i = (0); i < (x); ++i) {
    num_occ.insert(make_pair(0, i));
  }
  for (int i = (0); i < (q); ++i) {
    int y;
    cin >> y;
    int mod = y % x;
    num_occ.erase(make_pair(freq[mod], mod));
    num_occ.insert(make_pair(++freq[mod], mod));
    auto low = *num_occ.begin();
    cout << (low.first) * x + low.second << '\n';
  }
  return 0;
}
