#include <bits/stdc++.h>
using namespace std;
int a[400005];
int q, x;
int main() {
  int aux, cnt = 0, maxim = 0;
  cin >> q >> x;
  for (int i = 1; i <= q; i++) {
    cin >> aux;
    a[aux % x]++;
    while (a[cnt] > maxim) {
      cnt++;
      if (cnt == x) {
        cnt = 0;
        maxim++;
      }
    }
    cout << maxim * x + cnt << "\n";
  }
  return 0;
}
