#include <bits/stdc++.h>
using namespace std;
int main() {
  int q, x;
  cin >> q >> x;
  int i;
  vector<int> y(q);
  for (i = 0; i < q; i++) cin >> y.at(i);
  for (i = 0; i < q; i++) y.at(i) %= x;
  vector<int> nums(x, 0);
  int now = 0;
  int req = 0;
  for (i = 0; i < q; i++) {
    nums.at(y.at(i))++;
    while (nums.at(now % x) > req) {
      now++;
      if (now % x == 0) req++;
    }
    cout << now << endl;
  }
}
