#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long int t, x;
  cin >> t >> x;
  map<long long int, long long int> ma;
  long long int mex = 0;
  while (t--) {
    long long int n;
    cin >> n;
    if (n >= mex) {
      if ((n - mex) % x == 0) {
        n = mex;
        ma[n]++;
        while (ma[mex] != 0) {
          mex++;
        }
      } else {
        long long int flag = 0;
        long long int b = n;
        while (b > mex) {
          b = b - x;
        }
        while (ma[b] != 0) {
          b = b + x;
          if (b > 500000) {
            break;
          }
        }
        ma[b]++;
      }
    } else {
      if ((mex - n) % x == 0) {
        n = mex;
        ma[n]++;
        while (ma[mex] != 0) {
          mex++;
        }
      } else {
        while (ma[n] != 0) {
          n = n + x;
        }
        if (n > 500000) {
          break;
        }
      }
    }
    cout << mex << endl;
  }
}
