#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(0);
  int q, i, j, n, x;
  int a[500000];
  cin >> n >> x;
  for (int i = 0; i < x; i++) a[i] = 0;
  i = 0;
  for (int j = 0; j < n; j++) {
    cin >> q;
    a[q % x]++;
    while (a[i % x] > 0) {
      a[i % x]--;
      i++;
    }
    cout << i << endl;
  }
}
