#include <bits/stdc++.h>
using namespace std;
template <class T>
void show(const vector<T> &a) {
  for (T x : a) cout << x << " ";
  cout << '\n';
}
const long long N = 4e5 + 100, oo = 1e18 + 9;
const long long mod = 1e9 + 7;
const long double eps = 1e-9, PI = 2 * acos(0.0);
long long n, m, k;
long long cnt = 0;
long long ost[N];
long long kol[N];
signed main() {
  ios::sync_with_stdio(0);
  cout.tie(0);
  cin.tie(0);
  long long t, x;
  cin >> t >> x;
  map<long long, set<long long>> first;
  for (long long i = 0; i < x; i++) {
    first[0].insert(i);
  }
  long long mn = 0;
  kol[mn] = x;
  vector<long long> ans;
  while (t--) {
    long long y;
    cin >> y;
    kol[ost[y % x]]--;
    first[ost[y % x]].erase(y % x);
    ost[y % x]++;
    kol[ost[y % x]]++;
    first[ost[y % x]].insert(y % x);
    if (!kol[mn]) {
      mn++;
    }
    ans.push_back(mn * x + *first[mn].begin());
  }
  for (auto to : ans) {
    cout << to << '\n';
  }
}
