#include <bits/stdc++.h>
using namespace std;
signed main() {
  long long int i, j, y, q, x, p = 0;
  cin >> q >> x;
  unordered_map<long long int, long long int> pr, v;
  for (i = 0; i < q; i++) {
    cin >> y;
    long long int r = y % x;
    pr[r]++;
    v[(pr[r] - 1) * x + r] = 1;
    while (v.find(p) != v.end()) p++;
    cout << p << endl;
  }
}
