#include <bits/stdc++.h>
using namespace std;
const int inf = 1e6;
const int mx = 4e5 + 5;
const int v4i[4] = {0, 0, -1, 1};
const int v4j[4] = {-1, 1, 0, 0};
const int v8i[8] = {-1, -1, -1, 0, 0, 1, 1, 1};
const int v8j[8] = {-1, 0, 1, -1, 1, -1, 0, 1};
int qry, x;
int a[mx];
int main() {
  ios_base::sync_with_stdio(0);
  cin >> qry >> x;
  map<int, int> m;
  for (int i = 0; i < x; i++) m[i] = i;
  int cur = 0;
  while (qry--) {
    long long y;
    cin >> y;
    y %= x;
    a[m[y]] = 1;
    m[y] += x;
    while (a[cur]) cur++;
    cout << cur << endl;
  }
  return 0;
}
