#include <bits/stdc++.h>
using namespace std;
const long long mod = 998244353;
long long power(long long a, long long b) {
  if (b == 1) {
    return a;
  } else if (b & 1) {
    return (a % mod * power((a % mod * a % mod) % mod, b / 2)) % mod;
  } else {
    return (power((a % mod * a % mod) % mod, b / 2)) % mod;
  }
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int t, x, a;
  cin >> t >> x;
  map<int, bool> mp;
  int prev = 0;
  for (int i = 0; i < t; i++) {
    cin >> a;
    if ((prev - a) % x == 0) {
      mp[prev] = true;
      for (int j = prev + 1; j <= prev + x; j++) {
        if (!mp[j]) {
          prev = j;
          cout << prev << endl;
          break;
        }
      }
    } else {
      if (a > prev) {
        a = a % x;
      }
      int k = (prev - a) / x + 1;
      mp[a + k * x] = true;
      cout << prev << endl;
    }
  }
}
