#include <bits/stdc++.h>
using namespace std;
const int MAX = 2e6;
int factor[MAX];
bool visited[MAX];
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  long long q, x, y;
  cin >> q >> x;
  memset(factor, 0, sizeof(factor));
  memset(visited, 0, sizeof(visited));
  long long rem, v = 0;
  while (q--) {
    cin >> y;
    rem = y % x;
    rem = (rem == 0) ? x : rem;
    if ((rem % x) + x * factor[rem] < 2000000) {
      visited[(rem % x) + x * factor[rem]] = 1;
      ++factor[rem];
    }
    for (; visited[v]; ++v)
      ;
    cout << v << '\n';
  }
  return 0;
}
