#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int q, x, num;
  cin >> q >> x;
  vector<int> counter(x, 0);
  int res = 0;
  for (int i = 0; i < q; i++) {
    cin >> num;
    counter[num % x]++;
    while (counter[res % x] >= res / x + 1) {
      ++res;
    }
    cout << res << endl;
  }
}
