#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long int n, x, mex = 0;
  map<long long int, long long int> mpp;
  cin >> n >> x;
  for (long long int i = 1; i <= n; i++) {
    long long int ele;
    cin >> ele;
    if (ele == mex) {
      mpp[ele]++;
    } else if (ele < mex) {
      long long int diff = (mex - ele);
      if (diff % x == 0) {
        mpp[mex]++;
      } else {
        long long int minno = (((diff) / x) + 1) * x + ele;
        while (mpp[minno]) {
          minno = minno + x;
        }
        mpp[minno]++;
      }
    } else {
      long long int diff = (ele - mex);
      if ((diff % x) == 0) {
        mpp[mex]++;
      } else {
        long long int temp = mex;
        while (((long long int)(abs(ele - temp))) % x) {
          temp++;
        }
        mpp[temp]++;
      }
    }
    while (mpp[mex]) {
      mex++;
    }
    cout << mex << "\n";
  }
}
