#include <bits/stdc++.h>
#pragma GCC optimize("Ofast,no-stack-protector,unroll-loops,fast-math,O3")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
using namespace std;
const int inf = 1e9 + 7;
const int N = 4e5 + 4;
int cnt[N];
int t[4 * N];
int Q, x;
void upd(int v, int tl, int tr, int id, int val) {
  if (tl == tr && tr == id) {
    t[v] = val;
    return;
  }
  if (tl > id || tr < id) return;
  int tm = (tl + tr) / 2;
  upd(v * 2, tl, tm, id, val);
  upd(v * 2 + 1, tm + 1, tr, id, val);
  t[v] = min(t[v * 2], t[v * 2 + 1]);
}
int search(int v, int tl, int tr) {
  if (tl == tr) {
    return tl;
  }
  int tm = (tl + tr) / 2;
  if (t[v * 2] == t[v]) {
    return search(v * 2, tl, tm);
  } else {
    return search(v * 2 + 1, tm + 1, tr);
  }
}
signed main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> Q >> x;
  while (Q--) {
    int a;
    cin >> a;
    a %= x;
    cnt[a]++;
    upd(1, 0, x - 1, a, cnt[a]);
    int ans = t[1] * x;
    ans += search(1, 0, x - 1);
    cout << ans << '\n';
  }
  return 0;
}
