#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1e9 + 7;
const long long MOD2 = 998244353;
const long long N = 4e5 + 5;
const long double pi = 3.14159265359;
long long q, x, y, cnt[N];
set<pair<long long, long long> > s;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cin >> q >> x;
  for (long long i = 0; i < x; i++) s.insert(make_pair(cnt[i], i));
  while (q--) {
    cin >> y;
    y %= x;
    s.erase(make_pair(cnt[y], y));
    cnt[y]++;
    s.insert(make_pair(cnt[y], y));
    cout << s.begin()->first * x + s.begin()->second << "\n";
  }
  return 0;
}
