#include <bits/stdc++.h>
using namespace std;
const int INF = 2e9 + 10;
const int MOD = 1e9 + 7;
const int N = 1e6 + 10;
int n, m, t, q, x, y;
string s;
int check[N], mod[N];
int main() {
  ios_base::sync_with_stdio(0);
  cout.tie(0);
  cin.tie(0);
  for (int i = 0; i < N; i++) {
    mod[i] = -1;
    check[i] = 0;
  }
  cin >> q >> x;
  int it = 0;
  while (q--) {
    cin >> y;
    y %= x;
    if (mod[y] == -1) {
      mod[y] = y;
      check[y] = 1;
    } else {
      if (mod[y] + x < N) {
        mod[y] += x;
      }
      check[mod[y]] = 1;
    }
    while (check[it]) {
      it++;
    }
    cout << it << "\n";
  }
  return 0;
}
