#include <bits/stdc++.h>
using namespace std;
int n, x, i, sol, a, f[400010];
int main() {
  cin >> n >> x;
  sol = 0;
  for (i = 1; i <= n; i++) {
    cin >> a;
    f[a % x]++;
    while (f[sol % x]) {
      f[sol % x]--;
      sol++;
    }
    cout << sol << "\n";
  }
  return 0;
}
