#include <bits/stdc++.h>
const int INF = 1e8;
const long long MOD = 1e9 + 7;
using namespace std;
int cub[400005];
int tocar[400005];
map<int, int> ti;
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  int t = 1;
  int n, x;
  for (int nc = 0; nc < t; nc++) {
    cin >> n >> x;
    vector<int> v(n);
    for (int i = 0; i < n; i++) cin >> v[i];
    int amex = 0;
    int ind = 0;
    for (int i = 0; i < n; i++) {
      int t = v[i] / x;
      int mini = (v[i] - t * x);
      int pos = mini + ti[mini] * x;
      ti[mini]++;
      if (pos <= 4 * 100000 && pos >= 0) cub[pos] = 1;
      while (cub[ind] != 0) {
        ind++;
      }
      cout << ind << "\n";
    }
  }
  return 0;
}
