#include <bits/stdc++.h>
using namespace std;
int main() {
  long long q, x;
  cin >> q >> x;
  set<pair<int, int>> s1;
  for (int i = 0; i < x; i++) s1.insert({0, i});
  map<int, int> mp;
  while (q--) {
    long long a;
    cin >> a;
    a %= x;
    s1.erase({mp[a], a});
    mp[a]++;
    s1.insert({mp[a], a});
    cout << s1.begin()->first * x + s1.begin()->second << endl;
  }
}
